magdap116 commited on
Commit
d92692d
·
verified ·
1 Parent(s): 0127e19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -4
app.py CHANGED
@@ -21,7 +21,35 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
21
  cache = {}
22
 
23
  web_search = DuckDuckGoSearchTool()
24
- python_interpreter = PythonInterpreterTool()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  visit_webpage_tool = VisitWebpageTool()
26
  wiki_tool = WikipediaPageFetcher()
27
  yt_transcript_fetcher = YoutubeTranscriptFetcher()
@@ -70,8 +98,8 @@ def load_model(model_name):
70
  # Load the model and tokenizer locally
71
  # model, tokenizer = load_model()
72
 
73
- model_id = "meta-llama/Llama-3.1-8B-Instruct" # "microsoft/phi-2"# not working out of the box"google/gemma-2-2b-it" #toobig"Qwen/Qwen1.5-7B-Chat"#working but stupid: "meta-llama/Llama-3.2-3B-Instruct"
74
- model = HfApiModel(model_id)
75
  #from smolagents import TransformersModel
76
  # model = TransformersModel(
77
  # model_id=model_id,
@@ -91,7 +119,7 @@ class BasicAgent:
91
  grammar=None,
92
  planning_interval=3,
93
  add_base_tools=True,
94
- additional_authorized_imports=['requests', 'wikipedia', 'pandas']
95
 
96
  )
97
 
 
21
  cache = {}
22
 
23
  web_search = DuckDuckGoSearchTool()
24
+ python_interpreter = PythonInterpreterTool(authorized_imports = [
25
+ # standard library
26
+ 'os', # For file path manipulation, checking existence, deletion
27
+ 'glob', # Find files matching specific patterns
28
+ 'pathlib', # Alternative for path manipulation
29
+ 'sys',
30
+ 'math',
31
+ 'random',
32
+ 'datetime',
33
+ 'time',
34
+ 'json',
35
+ 'csv',
36
+ 're',
37
+ 'collections',
38
+ 'itertools',
39
+ 'functools',
40
+ 'io',
41
+ 'base64',
42
+ 'hashlib',
43
+ 'pathlib',
44
+ 'glob',
45
+
46
+ # Third-Party Libraries (ensure they are installed in the execution env)
47
+ 'pandas', # Data manipulation and analysis
48
+ 'numpy', # Numerical operations
49
+ 'scipy', # Scientific and technical computing (stats, optimize, etc.)
50
+ 'sklearn', # Machine learning
51
+
52
+ ])
53
  visit_webpage_tool = VisitWebpageTool()
54
  wiki_tool = WikipediaPageFetcher()
55
  yt_transcript_fetcher = YoutubeTranscriptFetcher()
 
98
  # Load the model and tokenizer locally
99
  # model, tokenizer = load_model()
100
 
101
+ #model_id = "meta-llama/Llama-3.1-8B-Instruct" # "microsoft/phi-2"# not working out of the box"google/gemma-2-2b-it" #toobig"Qwen/Qwen1.5-7B-Chat"#working but stupid: "meta-llama/Llama-3.2-3B-Instruct"
102
+ model = HfApiModel()
103
  #from smolagents import TransformersModel
104
  # model = TransformersModel(
105
  # model_id=model_id,
 
119
  grammar=None,
120
  planning_interval=3,
121
  add_base_tools=True,
122
+ additional_authorized_imports=['requests', 'wikipedia', 'pandas','datetime']
123
 
124
  )
125