AI-CC-Eric commited on
Commit
a50aa0a
·
verified ·
1 Parent(s): 0e23e87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -14,9 +14,22 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  class BasicAgent:
15
  def __init__(self):
16
  print("BasicAgent initialized.")
 
 
 
 
 
 
 
 
 
 
17
  def __call__(self, question: str) -> str:
18
  print(f"Agent received question (first 50 chars): {question[:50]}...")
19
- fixed_answer = "This is a default answer."
 
 
 
20
  print(f"Agent returning fixed answer: {fixed_answer}")
21
  return fixed_answer
22
 
 
14
  class BasicAgent:
15
  def __init__(self):
16
  print("BasicAgent initialized.")
17
+ image_generation_tool = load_tool("m-ric/text-to-image", trust_remote_code=True)
18
+
19
+ search_tool = DuckDuckGoSearchTool()
20
+
21
+ self.agent = CodeAgent(
22
+ tools=[search_tool, image_generation_tool],
23
+ model=InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct"),
24
+ planning_interval=3 # This is where you activate planning!
25
+ )
26
+
27
  def __call__(self, question: str) -> str:
28
  print(f"Agent received question (first 50 chars): {question[:50]}...")
29
+ # Run it!
30
+ fixed_answer = self.agent.run(
31
+ question
32
+ )
33
  print(f"Agent returning fixed answer: {fixed_answer}")
34
  return fixed_answer
35