lezaf commited on
Commit
1b2ed4d
·
verified ·
1 Parent(s): c0e9054

Add HF access token

Browse files

Added HF access token to use for the inference model. Also, did some formatting.

Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
2
  import datetime
 
3
  import requests
4
  import pytz
5
  import yaml
@@ -33,14 +34,17 @@ def get_current_time_in_timezone(timezone: str) -> str:
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
 
 
36
 
37
  final_answer = FinalAnswerTool()
38
  model = HfApiModel(
39
- max_tokens=2096,
40
- temperature=0.5,
41
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
42
- custom_role_conversions=None,
43
- )
 
44
 
45
 
46
  # Import tool from Hub
 
1
  from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
2
  import datetime
3
+ import os
4
  import requests
5
  import pytz
6
  import yaml
 
34
  except Exception as e:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
37
+ # Read HF token
38
+ access_token = os.getenv('HF_COURSE_TOKEN')
39
 
40
  final_answer = FinalAnswerTool()
41
  model = HfApiModel(
42
+ token=access_token,
43
+ max_tokens=2096,
44
+ temperature=0.5,
45
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
46
+ custom_role_conversions=None,
47
+ )
48
 
49
 
50
  # Import tool from Hub