rayshunp commited on
Commit
0665f58
·
verified ·
1 Parent(s): 7aae796

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -59,8 +59,10 @@ def predict(text: str):
59
  return "⚠️ Please enter a reaction description.", None, None
60
 
61
  # ── 1. Severity prediction ──
62
- results = clf_pipeline(text)[0] # list of {label, score}
63
- scores = {r["label"]: r["score"] for r in results}
 
 
64
 
65
  # Normalise to expected label keys
66
  # The model may emit "LABEL_0"/"LABEL_1" or "Non-Severe"/"Severe"
 
59
  return "⚠️ Please enter a reaction description.", None, None
60
 
61
  # ── 1. Severity prediction ──
62
+ raw = clf_pipeline(text)
63
+ # Handle both [[{...}]] and [{...}] shapes
64
+ results = raw[0] if isinstance(raw[0], list) else raw
65
+ scores = {r["label"]: r["score"] for r in results}
66
 
67
  # Normalise to expected label keys
68
  # The model may emit "LABEL_0"/"LABEL_1" or "Non-Severe"/"Severe"