ai: return model_name

This commit is contained in:
Fam Zheng 2026-01-24 12:21:16 +00:00
parent 34eeee33da
commit 55f79343d9
2 changed files with 4 additions and 1 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ build
/api/db.sqlite3 /api/db.sqlite3
/emblemscanner-release /emblemscanner-release
models models
emblem5/ai/data/

View File

@ -83,7 +83,8 @@ def find_best_frame(files):
def do_qr_verify(): def do_qr_verify():
start_time = time.time() start_time = time.time()
fd = flask.request.form fd = flask.request.form
model_path, model_md5 = download_model(fd.get('model', default_model)) model_name = fd.get('model', default_model)
model_path, model_md5 = download_model(model_name)
model, transforms = load_model(model_path) model, transforms = load_model(model_path)
frame_image, clarities = find_best_frame(flask.request.files) frame_image, clarities = find_best_frame(flask.request.files)
@ -110,6 +111,7 @@ def do_qr_verify():
"probabilities": ', '.join([f'{v:.2%}' for k, v in probabilities]), "probabilities": ', '.join([f'{v:.2%}' for k, v in probabilities]),
"clarities": clarities, "clarities": clarities,
"model_md5": model_md5, "model_md5": model_md5,
"model_name": model_name,
} }
} }