Brunwo commited on
Commit
719e83e
·
1 Parent(s): 5a0d86a

add HF Token and load .env (local)

Browse files
Files changed (3) hide show
  1. .env.template +2 -0
  2. HFHub.py +11 -11
  3. app.py +6 -0
.env.template ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ HF_TOKEN=
2
+ HF_TOKEN_WRITE=
HFHub.py CHANGED
@@ -16,17 +16,17 @@ tool_Collections: dict[str, ToolCollection] = {}
16
  loaded_tools: Set[Tool] = set()
17
 
18
  #kueep separate list, maybe should only refer to agent tools merged list ?
19
- def all_tools_names2() -> list[Tool]:
20
- all_tools = []
21
- for collection in tool_Collections.values():
22
- if isinstance(collection, ToolCollection):
23
- for tool in collection.tools:
24
- all_tools.append(tool.name) #new we return key, not the tool
25
- else:
26
- for tool in collection: # base tools : only keys str
27
- all_tools.append(tool)
28
-
29
- return all_tools
30
 
31
  def filter_tools(tools):
32
  base_tools_names = ['web search']
 
16
  loaded_tools: Set[Tool] = set()
17
 
18
  #kueep separate list, maybe should only refer to agent tools merged list ?
19
+ # def all_tools_names2() -> list[Tool]:
20
+ # all_tools = []
21
+ # for collection in tool_Collections.values():
22
+ # if isinstance(collection, ToolCollection):
23
+ # for tool in collection.tools:
24
+ # all_tools.append(tool.name) #new we return key, not the tool
25
+ # else:
26
+ # for tool in collection: # base tools : only keys str
27
+ # all_tools.append(tool)
28
+
29
+ # return all_tools
30
 
31
  def filter_tools(tools):
32
  base_tools_names = ['web search']
app.py CHANGED
@@ -5,6 +5,12 @@ import logging
5
  import inspect
6
  from huggingface_hub import login
7
  from smolagents import ToolCollection, CodeAgent, Tool, HfApiModel
 
 
 
 
 
 
8
  # Configure logging
9
  logging.basicConfig(level=logging.INFO)
10
  logging.warning('Starting application...')
 
5
  import inspect
6
  from huggingface_hub import login
7
  from smolagents import ToolCollection, CodeAgent, Tool, HfApiModel
8
+ from dotenv import load_dotenv
9
+
10
+ #local setup (load token when not on spaces)
11
+ # load_dotenv(verbose=True)
12
+ # login(token=os.getenv('HF_TOKEN'))
13
+
14
  # Configure logging
15
  logging.basicConfig(level=logging.INFO)
16
  logging.warning('Starting application...')