AIVAHr-project commited on
Commit
7b57ba9
·
verified ·
1 Parent(s): 87afde6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -52,7 +52,23 @@ def get_hugging_face_top_daily_paper() -> str:
52
  # --- Basic Agent Definition ---
53
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
54
  class BasicAgent:
55
- class BasicAgent:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  def __init__(self):
57
  # Get Hugging Face API token from environment variables
58
  HF_TOKEN = os.getenv("HF_API_KEY")
 
52
  # --- Basic Agent Definition ---
53
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
54
  class BasicAgent:
55
+ class BasicAgeclass BasicAgent:
56
+ def __init__(self):
57
+ HF_TOKEN = os.getenv("HF_API_KEY")
58
+ model = HfApiModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", api_key=HF_TOKEN)
59
+ search_tool = DuckDuckGoSearchTool()
60
+ self.agent = CodeAgent(
61
+ tools=[search_tool, get_hugging_face_top_daily_paper],
62
+ model=model,
63
+ additional_authorized_imports=["requests", "bs4", "json"]
64
+ )
65
+
66
+ def run(self, input_text):
67
+ # Explicitly call run() method of agent instead of invoking the agent directly
68
+ if hasattr(self.agent, 'run'):
69
+ return self.agent.run(input_text) # Call the `run` method of CodeAgent
70
+ else:
71
+ raise AttributeError("The agent does not have a 'run' method.")nt:
72
  def __init__(self):
73
  # Get Hugging Face API token from environment variables
74
  HF_TOKEN = os.getenv("HF_API_KEY")