Skip to content

Commit

Permalink
fix(inference): return $error NO_MODEL_ID vs later crash on None
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Apr 14, 2023
1 parent 21a0425 commit 46ea977
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ def inference(all_inputs: dict) -> dict:

model_id = call_inputs.get("MODEL_ID", None)
if not model_id:
if not MODEL_ID:
return {
"$error": {
"code": "NO_MODEL_ID",
"message": "No callInputs.MODEL_ID specified, nor was MODEL_ID env var set.",
}
}
model_id = MODEL_ID
result["$meta"].update({"MODEL_ID": MODEL_ID})
normalized_model_id = model_id
Expand Down

0 comments on commit 46ea977

Please sign in to comment.