Spaces:
Paused
Paused
Commit
·
3437665
1
Parent(s):
0716eb7
Catch API error
Browse files
app.py
CHANGED
@@ -272,12 +272,12 @@ def run_model(mode_set, user_input):
|
|
272 |
inputs = inquire_prompt
|
273 |
attempts = 0
|
274 |
out = None
|
275 |
-
while out==None
|
|
|
276 |
try:
|
277 |
# api call
|
278 |
out = inference(inputs,INFERENCE_PARAMS)
|
279 |
except Exception:
|
280 |
-
attempts += 1
|
281 |
if attempts<MAX_API_CALLS:
|
282 |
st.warning(f"HF Inference API call (attempt {attempts} of {MAX_API_CALLS}) has failed. Trying again...")
|
283 |
else:
|
|
|
272 |
inputs = inquire_prompt
|
273 |
attempts = 0
|
274 |
out = None
|
275 |
+
while out==None and attempts<MAX_API_CALLS:
|
276 |
+
attempts += 1
|
277 |
try:
|
278 |
# api call
|
279 |
out = inference(inputs,INFERENCE_PARAMS)
|
280 |
except Exception:
|
|
|
281 |
if attempts<MAX_API_CALLS:
|
282 |
st.warning(f"HF Inference API call (attempt {attempts} of {MAX_API_CALLS}) has failed. Trying again...")
|
283 |
else:
|