Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, PythonInterpreterTool,
|
| 7 |
from groq import Groq
|
| 8 |
import time
|
| 9 |
|
|
@@ -20,7 +20,7 @@ GROQ_KEY = os.environ['GROQ_KEY']
|
|
| 20 |
class LLaMaAgent:
|
| 21 |
def __init__(self):
|
| 22 |
self.model = model = LiteLLMModel(
|
| 23 |
-
"llama-
|
| 24 |
api_base="https://api.groq.com/openai/v1",
|
| 25 |
api_key=GROQ_KEY,
|
| 26 |
)
|
|
@@ -146,21 +146,18 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 146 |
for item in questions_data:
|
| 147 |
task_id = item.get("task_id")
|
| 148 |
question_text = item.get("question")
|
| 149 |
-
time.sleep(30)
|
| 150 |
if not task_id or question_text is None:
|
| 151 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 152 |
continue
|
| 153 |
try:
|
| 154 |
-
|
| 155 |
-
submitted_answer = llama(question_text)
|
| 156 |
-
else:
|
| 157 |
-
submitted_answer = compound(question_text)
|
| 158 |
print(f"\n\n### Answer{submitted_answer} ###\n\n")
|
| 159 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 160 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 161 |
except Exception as e:
|
| 162 |
print(f"Error running agent on task {task_id}: {e}")
|
| 163 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
| 164 |
|
| 165 |
if not answers_payload:
|
| 166 |
print("Agent did not produce any answers to submit.")
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, FinalAnswerTool, PythonInterpreterTool, VisitWebpageTool, LiteLLMModel
|
| 7 |
from groq import Groq
|
| 8 |
import time
|
| 9 |
|
|
|
|
| 20 |
class LLaMaAgent:
|
| 21 |
def __init__(self):
|
| 22 |
self.model = model = LiteLLMModel(
|
| 23 |
+
"meta-llama/llama-4-scout-17b-16e-instruct",
|
| 24 |
api_base="https://api.groq.com/openai/v1",
|
| 25 |
api_key=GROQ_KEY,
|
| 26 |
)
|
|
|
|
| 146 |
for item in questions_data:
|
| 147 |
task_id = item.get("task_id")
|
| 148 |
question_text = item.get("question")
|
|
|
|
| 149 |
if not task_id or question_text is None:
|
| 150 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 151 |
continue
|
| 152 |
try:
|
| 153 |
+
submitted_answer = llama(question_text)
|
|
|
|
|
|
|
|
|
|
| 154 |
print(f"\n\n### Answer{submitted_answer} ###\n\n")
|
| 155 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 156 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 157 |
except Exception as e:
|
| 158 |
print(f"Error running agent on task {task_id}: {e}")
|
| 159 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
| 160 |
+
time.sleep(90)
|
| 161 |
|
| 162 |
if not answers_payload:
|
| 163 |
print("Agent did not produce any answers to submit.")
|