jjvelezo commited on
Commit
1f05742
·
verified ·
1 Parent(s): 44948e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
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,20 @@ 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,
@@ -159,6 +175,8 @@ with gr.Blocks() as demo:
159
  gr.LoginButton()
160
 
161
  run_button = gr.Button("Run Evaluation & Submit All Answers")
 
 
162
 
163
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
164
  # Removed max_rows=10 from DataFrame constructor
@@ -169,6 +187,11 @@ with gr.Blocks() as demo:
169
  outputs=[status_output, results_table]
170
  )
171
 
 
 
 
 
 
172
  if __name__ == "__main__":
173
  print("\n" + "-"*30 + " App Starting " + "-"*30)
174
  # Check for SPACE_HOST and SPACE_ID at startup for information
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
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
+ agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel())
28
+
29
+ def run_smol_agent():
30
+ question = "Search for the best music recommendations for a party at the Wayne's mansion."
31
+ response = agent.run(question)
32
+ print(f"Smol Agent Response: {response}")
33
+ return response
34
+
35
+
36
+
37
+
38
  def run_and_submit_all( profile: gr.OAuthProfile | None):
39
  """
40
  Fetches all questions, runs the BasicAgent on them, submits all answers,
 
175
  gr.LoginButton()
176
 
177
  run_button = gr.Button("Run Evaluation & Submit All Answers")
178
+ run_smol_agent_button = gr.Button("Run SmolAgent Search")
179
+
180
 
181
  status_output = gr.Textbox(label="Run Status / Submission Result", lines=5, interactive=False)
182
  # Removed max_rows=10 from DataFrame constructor
 
187
  outputs=[status_output, results_table]
188
  )
189
 
190
+ run_button.click(
191
+ fn=run_and_submit_all,
192
+ outputs=[status_output, results_table]
193
+ )
194
+
195
  if __name__ == "__main__":
196
  print("\n" + "-"*30 + " App Starting " + "-"*30)
197
  # Check for SPACE_HOST and SPACE_ID at startup for information