Maximofn commited on
Commit
fa1f4db
·
1 Parent(s): a7a6779

Add Hugging Face token support for model initialization

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -10,6 +10,13 @@ from tools.web_search import DuckDuckGoSearchTool
10
 
11
  from Gradio_UI import GradioUI
12
 
 
 
 
 
 
 
 
13
  @tool
14
  def web_search(query:str)-> str:
15
  """A tool that can search on the internet
@@ -73,10 +80,11 @@ web_searcher = DuckDuckGoSearchTool(max_results=5)
73
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
74
 
75
  model = HfApiModel(
76
- max_tokens=2096,
77
- temperature=0.5,
78
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
79
- custom_role_conversions=None,
 
80
  )
81
 
82
 
 
10
 
11
  from Gradio_UI import GradioUI
12
 
13
+ import os
14
+ import dotenv
15
+
16
+ dotenv.load_dotenv()
17
+
18
+ HF_TOKEN = os.getenv("HF_TOKEN", os.getenv("HF_TOKEN"))
19
+
20
  @tool
21
  def web_search(query:str)-> str:
22
  """A tool that can search on the internet
 
80
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
81
 
82
  model = HfApiModel(
83
+ max_tokens=2096,
84
+ temperature=0.5,
85
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
86
+ custom_role_conversions=None,
87
+ token=HF_TOKEN
88
  )
89
 
90