Spaces:
Runtime error
Runtime error
Commit
·
f61238b
1
Parent(s):
67cbf92
updates
Browse files- models/base.py +5 -7
models/base.py
CHANGED
|
@@ -39,11 +39,9 @@ class BaseModel:
|
|
| 39 |
payload = {'instances': [text], "parameters": parameters}
|
| 40 |
resp = requests.post(api, json=payload, timeout=600)
|
| 41 |
if resp.status_code != 200:
|
| 42 |
-
gr.Error(f"Endpoint returned code: {resp.status_code}
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
f"- if nothing helps — report the problem.")
|
| 48 |
-
# assert resp.status_code == 200, (resp.content, resp.status_code)
|
| 49 |
return resp.json()["predictions"][0].strip()
|
|
|
|
| 39 |
payload = {'instances': [text], "parameters": parameters}
|
| 40 |
resp = requests.post(api, json=payload, timeout=600)
|
| 41 |
if resp.status_code != 200:
|
| 42 |
+
raise gr.Error(f"Endpoint returned code: {resp.status_code}. "
|
| 43 |
+
f"Solution: "
|
| 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 |
return resp.json()["predictions"][0].strip()
|