ajac-zero commited on
Commit
952b959
·
1 Parent(s): eacc47f
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import os
2
  import gradio as gr
3
  import requests
4
- import inspect
5
  import pandas as pd
 
6
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
@@ -10,14 +10,19 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
10
 
11
  # --- Basic Agent Definition ---
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
 
13
  class BasicAgent:
14
  def __init__(self):
15
- print("BasicAgent initialized.")
 
 
 
 
 
 
 
16
  def __call__(self, question: str) -> str:
17
- print(f"Agent received question (first 50 chars): {question[:50]}...")
18
- fixed_answer = "This is a default answer."
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
  """
@@ -91,7 +96,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
91
  print("Agent did not produce any answers to submit.")
92
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
93
 
94
- # 4. Prepare Submission
95
  submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
96
  status_update = f"Agent finished. Submitting {len(answers_payload)} answers for user '{username}'..."
97
  print(status_update)
@@ -193,4 +198,4 @@ if __name__ == "__main__":
193
  print("-"*(60 + len(" App Starting ")) + "\n")
194
 
195
  print("Launching Gradio Interface for Basic Agent Evaluation...")
196
- demo.launch(debug=True, share=False)
 
1
  import os
2
  import gradio as gr
3
  import requests
 
4
  import pandas as pd
5
+ from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
6
 
7
  # (Keep Constants as is)
8
  # --- Constants ---
 
10
 
11
  # --- Basic Agent Definition ---
12
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
13
+
14
  class BasicAgent:
15
  def __init__(self):
16
+ model = InferenceClientModel("deepseek-ai/DeepSeek-V3")
17
+ search_tool = DuckDuckGoSearchTool()
18
+
19
+ self.agent = CodeAgent(
20
+ model=model,
21
+ tools=[search_tool]
22
+ )
23
+
24
  def __call__(self, question: str) -> str:
25
+ return str(self.agent.run(question))
 
 
 
26
 
27
  def run_and_submit_all( profile: gr.OAuthProfile | None):
28
  """
 
96
  print("Agent did not produce any answers to submit.")
97
  return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
98
 
99
+ # 4. Prepare Submission
100
  submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
101
  status_update = f"Agent finished. Submitting {len(answers_payload)} answers for user '{username}'..."
102
  print(status_update)
 
198
  print("-"*(60 + len(" App Starting ")) + "\n")
199
 
200
  print("Launching Gradio Interface for Basic Agent Evaluation...")
201
+ demo.launch(debug=True, share=False)