Gonzalo Lope commited on
Commit
d681a65
·
1 Parent(s): a186feb
Files changed (3) hide show
  1. .gitignore +2 -1
  2. app.py +5 -7
  3. smolagents_test.py +0 -17
.gitignore CHANGED
@@ -1 +1,2 @@
1
- .env
 
 
1
+ .env
2
+ smolagents_test_new.py
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_test import agent
7
  import json
8
 
9
  # (Keep Constants as is)
@@ -15,14 +15,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
15
  class BasicAgent:
16
  def __init__(self):
17
  print("BasicAgent initialized.")
18
- self.agent = agent # Use the imported agent from smolagents_test.py
19
  def __call__(self, question: str) -> str:
20
  # Add question to a file
21
  with open("questions.txt", "a") as f:
22
  f.write(f"{question}\n{'-'*50}\n")
23
 
24
  print(f"Agent received question (first 50 chars): {question}...")
25
- answer = self.agent.run(question)
26
  print(f"Agent returning fixed answer: {answer}")
27
  return answer
28
 
@@ -80,11 +79,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
80
  results_log = []
81
  answers_payload = []
82
  print(f"Running agent on {len(questions_data)} questions...")
 
 
 
83
  for item in questions_data:
84
- # Add question data to a json file
85
- with open("questions.json", "a") as f:
86
- json.dump(item, f)
87
- f.write("\n")
88
  task_id = item.get("task_id")
89
  question_text = item.get("question")
90
  if not task_id or question_text is None:
 
3
  import requests
4
  import inspect
5
  import pandas as pd
6
+ # from smolagents_test_new import agent
7
  import json
8
 
9
  # (Keep Constants as is)
 
15
  class BasicAgent:
16
  def __init__(self):
17
  print("BasicAgent initialized.")
 
18
  def __call__(self, question: str) -> str:
19
  # Add question to a file
20
  with open("questions.txt", "a") as f:
21
  f.write(f"{question}\n{'-'*50}\n")
22
 
23
  print(f"Agent received question (first 50 chars): {question}...")
24
+ answer = "default"
25
  print(f"Agent returning fixed answer: {answer}")
26
  return answer
27
 
 
79
  results_log = []
80
  answers_payload = []
81
  print(f"Running agent on {len(questions_data)} questions...")
82
+ # Add question data to a json file
83
+ with open("questions_full.json", "w") as f:
84
+ json.dump(questions_data, f, indent=4)
85
  for item in questions_data:
 
 
 
 
86
  task_id = item.get("task_id")
87
  question_text = item.get("question")
88
  if not task_id or question_text is None:
smolagents_test.py DELETED
@@ -1,17 +0,0 @@
1
- from huggingface_hub import login
2
- from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel
3
-
4
-
5
- model_ctc = OpenAIServerModel(
6
- model_id="google/gemma-3-27b-it",
7
- api_key="EMPTY",
8
- api_base="http://10.10.48.10:8088/v1"
9
- )
10
-
11
-
12
-
13
- agent = CodeAgent(tools=[], model=model_ctc)
14
-
15
-
16
- if __name__ == "__main__":
17
- agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")