Spaces:
Sleeping
Sleeping
update agent model and add sleep delay in run_and_submit_all function
Browse files- app.py +3 -1
- geminiAgent.py +1 -1
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import gradio as gr
|
|
| 4 |
import requests
|
| 5 |
import inspect
|
| 6 |
import pandas as pd
|
|
|
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -84,7 +85,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 84 |
try:
|
| 85 |
submitted_answer = agent(question_text)
|
| 86 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 87 |
-
|
|
|
|
| 88 |
except Exception as e:
|
| 89 |
print(f"Error running agent on task {task_id}: {e}")
|
| 90 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
| 4 |
import requests
|
| 5 |
import inspect
|
| 6 |
import pandas as pd
|
| 7 |
+
import time
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
| 10 |
# --- Constants ---
|
|
|
|
| 85 |
try:
|
| 86 |
submitted_answer = agent(question_text)
|
| 87 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 88 |
+
time.sleep(1)
|
| 89 |
+
thread.sleep(1)
|
| 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}"})
|
geminiAgent.py
CHANGED
|
@@ -16,7 +16,7 @@ from PIL import Image
|
|
| 16 |
|
| 17 |
def create_agent():
|
| 18 |
return CodeAgent(
|
| 19 |
-
model=LiteLLMModel(model_id="
|
| 20 |
tools=[DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), ocr_tool, read_csv, read_excel],
|
| 21 |
add_base_tools=True,
|
| 22 |
additional_authorized_imports=['pandas','numpy','csv','subprocess', 'exec']
|
|
|
|
| 16 |
|
| 17 |
def create_agent():
|
| 18 |
return CodeAgent(
|
| 19 |
+
model=LiteLLMModel(model_id="gemini/gemini-2.0-flash-lite-001", api_key=os.getenv("GEMINI_KEY")),
|
| 20 |
tools=[DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), ocr_tool, read_csv, read_excel],
|
| 21 |
add_base_tools=True,
|
| 22 |
additional_authorized_imports=['pandas','numpy','csv','subprocess', 'exec']
|