avi080704 commited on
Commit
ce2aac8
·
verified ·
1 Parent(s): f4af367

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -99,6 +99,10 @@ def calculate(expression: str) -> str:
99
 
100
  class BasicAgent:
101
  def __init__(self):
 
 
 
 
102
  self.agent = CodeAgent(
103
  tools=[
104
  DuckDuckGoSearchTool(),
@@ -106,7 +110,10 @@ class BasicAgent:
106
  download_task_file,
107
  calculate,
108
  ],
109
- model=InferenceClientModel(model_id="Qwen/Qwen2.5-72B-Instruct"),
 
 
 
110
  max_steps=10,
111
  )
112
  print("BasicAgent initialized.")
 
99
 
100
  class BasicAgent:
101
  def __init__(self):
102
+ # HF_TOKEN is automatically available in HF Spaces when the space owner is logged in.
103
+ # Passing it explicitly ensures the InferenceClient can authenticate.
104
+ hf_token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_TOKEN")
105
+
106
  self.agent = CodeAgent(
107
  tools=[
108
  DuckDuckGoSearchTool(),
 
110
  download_task_file,
111
  calculate,
112
  ],
113
+ model=InferenceClientModel(
114
+ model_id="Qwen/Qwen2.5-72B-Instruct",
115
+ token=hf_token,
116
+ ),
117
  max_steps=10,
118
  )
119
  print("BasicAgent initialized.")