Spaces:
Running
Running
Pycrolis
commited on
Commit
·
6c7caab
1
Parent(s):
331b5a4
fix(agent): add rate limit handling with delay to prevent errors
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
@@ -87,6 +88,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
87 |
submitted_answer = agent(question_with_attachment)
|
88 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
89 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
90 |
except Exception as e:
|
91 |
print(f"Error running agent on task {task_id}: {e}")
|
92 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
1 |
import os
|
2 |
+
import time
|
3 |
|
4 |
import gradio as gr
|
5 |
import pandas as pd
|
|
|
88 |
submitted_answer = agent(question_with_attachment)
|
89 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
90 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
91 |
+
time.sleep(70) # wait for reducing rate limit errors
|
92 |
except Exception as e:
|
93 |
print(f"Error running agent on task {task_id}: {e}")
|
94 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|