ekkasilina commited on
Commit
22abd40
·
verified ·
1 Parent(s): 81917a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -3,6 +3,8 @@ import gradio as gr
3
  import requests
4
  import inspect
5
  import pandas as pd
 
 
6
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
@@ -19,6 +21,11 @@ class BasicAgent:
19
  print(f"Agent returning fixed answer: {fixed_answer}")
20
  return fixed_answer
21
 
 
 
 
 
 
22
  def run_and_submit_all( profile: gr.OAuthProfile | None):
23
  """
24
  Fetches all questions, runs the BasicAgent on them, submits all answers,
@@ -40,7 +47,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
40
 
41
  # 1. Instantiate Agent ( modify this part to create your agent)
42
  try:
43
- agent = BasicAgent()
 
 
 
 
44
  except Exception as e:
45
  print(f"Error instantiating agent: {e}")
46
  return f"Error initializing agent: {e}", None
@@ -80,7 +91,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
80
  print(f"Skipping item with missing task_id or question: {item}")
81
  continue
82
  try:
83
- submitted_answer = agent(question_text)
 
84
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
85
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
86
  except Exception as e:
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
7
+
8
 
9
  # (Keep Constants as is)
10
  # --- Constants ---
 
21
  print(f"Agent returning fixed answer: {fixed_answer}")
22
  return fixed_answer
23
 
24
+
25
+
26
+
27
+
28
+
29
  def run_and_submit_all( profile: gr.OAuthProfile | None):
30
  """
31
  Fetches all questions, runs the BasicAgent on them, submits all answers,
 
47
 
48
  # 1. Instantiate Agent ( modify this part to create your agent)
49
  try:
50
+ # agent = BasicAgent()
51
+ model = InferenceClientModel()
52
+ search_tool = DuckDuckGoSearchTool()
53
+ my_small_agent = CodeAgent(tools=[search_tool], model=model)
54
+
55
  except Exception as e:
56
  print(f"Error instantiating agent: {e}")
57
  return f"Error initializing agent: {e}", None
 
91
  print(f"Skipping item with missing task_id or question: {item}")
92
  continue
93
  try:
94
+ #submitted_answer = agent(question_text)
95
+ submitted_answer = my_small_agent.run(question_text)
96
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
97
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
98
  except Exception as e: