Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -337,21 +337,20 @@ with gr.Blocks(title="Quiz Maker", theme=gr.themes.Default(primary_hue="green",
|
|
| 337 |
do_sample=True,
|
| 338 |
seed=42,
|
| 339 |
)
|
| 340 |
-
|
|
|
|
| 341 |
try:
|
| 342 |
response = client.text_generation(
|
| 343 |
formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False,
|
| 344 |
)
|
| 345 |
output_json = json.loads(f"{response}")
|
| 346 |
break
|
| 347 |
-
except Exception as e
|
|
|
|
| 348 |
print(f"Exception occurred: {e}")
|
| 349 |
print("Trying again...please wait")
|
| 350 |
continue
|
| 351 |
-
|
| 352 |
-
formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False,
|
| 353 |
-
)
|
| 354 |
-
|
| 355 |
print(response)
|
| 356 |
print('output json', output_json)
|
| 357 |
|
|
|
|
| 337 |
do_sample=True,
|
| 338 |
seed=42,
|
| 339 |
)
|
| 340 |
+
count=0
|
| 341 |
+
while count<=3:
|
| 342 |
try:
|
| 343 |
response = client.text_generation(
|
| 344 |
formatted_prompt, **generate_kwargs, stream=False, details=False, return_full_text=False,
|
| 345 |
)
|
| 346 |
output_json = json.loads(f"{response}")
|
| 347 |
break
|
| 348 |
+
except Exception as e
|
| 349 |
+
count+=1
|
| 350 |
print(f"Exception occurred: {e}")
|
| 351 |
print("Trying again...please wait")
|
| 352 |
continue
|
| 353 |
+
|
|
|
|
|
|
|
|
|
|
| 354 |
print(response)
|
| 355 |
print('output json', output_json)
|
| 356 |
|