cjb97 commited on
Commit
e515432
·
1 Parent(s): f0f5765

added HF Token

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -2,17 +2,24 @@ from smolagents import CodeAgent, HfApiModel
2
  import yaml
3
  from tools import FinalAnswerTool, WeatherTool, DuckDuckGoSearchTool
4
  from Gradio_UI import GradioUI
 
5
 
6
  # Initialize our tools
7
  final_answer = FinalAnswerTool()
8
  weather_tool = WeatherTool()
9
  search_tool = DuckDuckGoSearchTool()
10
 
 
 
 
 
 
11
  model = HfApiModel(
12
  max_tokens=2096,
13
  temperature=0.5,
14
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
15
  custom_role_conversions=None,
 
16
  )
17
 
18
  with open("prompts.yaml", 'r') as stream:
 
2
  import yaml
3
  from tools import FinalAnswerTool, WeatherTool, DuckDuckGoSearchTool
4
  from Gradio_UI import GradioUI
5
+ import os
6
 
7
  # Initialize our tools
8
  final_answer = FinalAnswerTool()
9
  weather_tool = WeatherTool()
10
  search_tool = DuckDuckGoSearchTool()
11
 
12
+ # Get the Hugging Face token from environment variable
13
+ hf_token = os.getenv('HUGGINGFACE_TOKEN')
14
+ if not hf_token:
15
+ raise ValueError("Please set the HUGGINGFACE_TOKEN environment variable")
16
+
17
  model = HfApiModel(
18
  max_tokens=2096,
19
  temperature=0.5,
20
  model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
21
  custom_role_conversions=None,
22
+ token=hf_token,
23
  )
24
 
25
  with open("prompts.yaml", 'r') as stream: