Spaces:
Runtime error
Runtime error
AlekseyKorshuk
commited on
Commit
·
fba604e
1
Parent(s):
dd2beab
updates
Browse files- models/base.py +5 -1
models/base.py
CHANGED
@@ -44,4 +44,8 @@ class BaseModel:
|
|
44 |
f"1. Scale-to-Zero enabled, so please wait for some minutes and try again. "
|
45 |
f"2. Probably the response generated by the model is to big, try changing max_new_tokens. "
|
46 |
f"3. If nothing helps — report the problem.")
|
47 |
-
|
|
|
|
|
|
|
|
|
|
44 |
f"1. Scale-to-Zero enabled, so please wait for some minutes and try again. "
|
45 |
f"2. Probably the response generated by the model is to big, try changing max_new_tokens. "
|
46 |
f"3. If nothing helps — report the problem.")
|
47 |
+
predictions = resp.json()["predictions"]
|
48 |
+
if isinstance(predictions[0], str):
|
49 |
+
return predictions[0].strip()
|
50 |
+
predictions = sorted(predictions, key=lambda d: d['score'])
|
51 |
+
return predictions[-1]["text"].strip()
|