henryk commited on
Commit
0b26958
·
verified ·
1 Parent(s): bc56a27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -14,12 +14,22 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  from smolagents import CodeAgent, HfApiModel
16
  from tools import TextTransformerTool
 
 
 
 
17
 
18
  class BasicAgent:
19
  def __init__(self):
20
  print("Initializing BasicAgent with tools...")
21
 
22
- model = HfApiModel()
 
 
 
 
 
 
23
  search_tool = DuckDuckGoSearchTool()
24
  text_tool = TextTransformerTool()
25
 
 
14
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
15
  from smolagents import CodeAgent, HfApiModel
16
  from tools import TextTransformerTool
17
+ import os
18
+ from smolagents import HfApiModel
19
+
20
+
21
 
22
  class BasicAgent:
23
  def __init__(self):
24
  print("Initializing BasicAgent with tools...")
25
 
26
+ # Ensure the token is available
27
+ hf_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
28
+ if not hf_token:
29
+ raise ValueError("Missing Hugging Face API token!")
30
+
31
+ # Pass it into the model
32
+ model = HfApiModel(token=hf_token)
33
  search_tool = DuckDuckGoSearchTool()
34
  text_tool = TextTransformerTool()
35