razvanfischer commited on
Commit
2ee9938
·
verified ·
1 Parent(s): 5d44854

Second try - fixed some minor bugs

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -16,13 +16,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
16
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
17
  class BasicAgent:
18
  def __init__(self):
19
- llm = HuggingFaceInferenceAPI(model_name="Qwen/Qwen2.5-Coder-32B-Instruct")
20
- search_tool = DuckDuckGoSearchToolSpec()
 
21
  print("BasicAgent initialized.")
22
 
23
  def __call__(self, question: str) -> str:
24
- agent = AgentWorkflow.from_tools_or_functions([search_tool], llm=llm)
25
- response = await agent.run(question)
26
  return response
27
 
28
  def run_and_submit_all( profile: gr.OAuthProfile | None):
 
16
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
17
  class BasicAgent:
18
  def __init__(self):
19
+ self.llm = HuggingFaceInferenceAPI(model_name="Qwen/Qwen2.5-Coder-32B-Instruct")
20
+ self.search_tool = DuckDuckGoSearchToolSpec()
21
+ self.agent = AgentWorkflow.from_tools_or_functions([self.search_tool], llm=self.llm)
22
  print("BasicAgent initialized.")
23
 
24
  def __call__(self, question: str) -> str:
25
+ response = await self.agent.run(question)
 
26
  return response
27
 
28
  def run_and_submit_all( profile: gr.OAuthProfile | None):