Update app.py
Browse files
app.py
CHANGED
|
@@ -41,18 +41,17 @@ def file_reader(file_path: str) -> str:
|
|
| 41 |
# --- Agent Class (Now using a free Open-Source LLM) ---
|
| 42 |
class GaiaSmolAgent:
|
| 43 |
def __init__(self):
|
| 44 |
-
#
|
| 45 |
-
|
| 46 |
-
api_key = os.getenv("GROQ_API_KEY")
|
| 47 |
if not api_key:
|
| 48 |
-
raise ValueError("API key '
|
| 49 |
|
| 50 |
#model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", provider="together")
|
| 51 |
|
| 52 |
|
| 53 |
self.planner_model = LiteLLMModel(
|
| 54 |
-
#
|
| 55 |
-
model_id="
|
| 56 |
api_key=api_key,
|
| 57 |
temperature=0.0,
|
| 58 |
)
|
|
@@ -183,8 +182,8 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 183 |
print(traceback.format_exc())
|
| 184 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_message, "Reasoning Trace": ""})
|
| 185 |
|
| 186 |
-
print("Pausing for
|
| 187 |
-
time.sleep(
|
| 188 |
|
| 189 |
if not answers_payload:
|
| 190 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
|
@@ -213,7 +212,7 @@ with gr.Blocks() as demo:
|
|
| 213 |
gr.Markdown(
|
| 214 |
"""
|
| 215 |
**Instructions:**
|
| 216 |
-
1. Ensure you have added your **
|
| 217 |
2. Log in to your Hugging Face account using the button below.
|
| 218 |
3. Click 'Run Evaluation & Submit All Answers' to run your agent and see the score.
|
| 219 |
"""
|
|
|
|
| 41 |
# --- Agent Class (Now using a free Open-Source LLM) ---
|
| 42 |
class GaiaSmolAgent:
|
| 43 |
def __init__(self):
|
| 44 |
+
#print("Initializing GaiaSmolAgent with a free Open-Source LLM via Groq...")
|
| 45 |
+
api_key = os.getenv("GEMINI_API_KEY")
|
|
|
|
| 46 |
if not api_key:
|
| 47 |
+
raise ValueError("API key 'GEMINI_API_KEY' not found in environment secrets.")
|
| 48 |
|
| 49 |
#model = InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", provider="together")
|
| 50 |
|
| 51 |
|
| 52 |
self.planner_model = LiteLLMModel(
|
| 53 |
+
#model_id="groq/llama3-8b-8192",
|
| 54 |
+
model_id="gemini/gemini-1.5-pro-latest",
|
| 55 |
api_key=api_key,
|
| 56 |
temperature=0.0,
|
| 57 |
)
|
|
|
|
| 182 |
print(traceback.format_exc())
|
| 183 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": error_message, "Reasoning Trace": ""})
|
| 184 |
|
| 185 |
+
print("Pausing for 3 seconds to respect API rate limits...")
|
| 186 |
+
time.sleep(3)
|
| 187 |
|
| 188 |
if not answers_payload:
|
| 189 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
|
|
|
| 212 |
gr.Markdown(
|
| 213 |
"""
|
| 214 |
**Instructions:**
|
| 215 |
+
1. Ensure you have added your **GEMINI API key** (as `GEMINI_API_KEY`) in the Space's secrets.
|
| 216 |
2. Log in to your Hugging Face account using the button below.
|
| 217 |
3. Click 'Run Evaluation & Submit All Answers' to run your agent and see the score.
|
| 218 |
"""
|