Skip to content

Commit

Permalink
feat(api): read model hash from file
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 27, 2023
1 parent 0029943 commit e3a458a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/onnx_web/output.py
Expand Up @@ -95,7 +95,14 @@ def str_params(
model_name = path.basename(path.normpath(params.model))
logger.debug("getting model hash for %s", model_name)

model_hash = get_extra_hashes().get(model_name, "unknown")
model_hash = get_extra_hashes().get(model_name, None)
if model_hash is None:
model_hash_path = path.join(params.model, "hash.txt")
if path.exists(model_hash_path):
with open(model_hash_path, "r") as f:
model_hash = f.readline()

model_hash = model_hash or "unknown"
hash_map = {
model_name: model_hash,
}
Expand Down

0 comments on commit e3a458a

Please sign in to comment.