AlekseyKorshuk commited on
Commit
f61238b
1 Parent(s): 67cbf92
Files changed (1) hide show
  1. 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}.\n"
43
- f"Content: {resp.content}.\n"
44
- f"Notes:\n"
45
- f"- we have scale-to-zero enabled, so please wait for some minutes and try again.\n"
46
- f"- probably the response generated by the model is to big, try changing max_new_tokens.\n"
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()