WingNeville commited on
Commit
9b46b99
·
verified ·
1 Parent(s): a08cf23

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -31
app.py CHANGED
@@ -1,44 +1,24 @@
1
- import yaml
2
  import os
3
-
4
- print(os.getenv('WingTokenAll'))
5
  from smolagents import GradioUI, CodeAgent, InferenceClientModel
6
 
7
- # Get current directory path
8
- CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
9
-
10
- from tools.web_search import DuckDuckGoSearchTool as WebSearch
11
- from tools.final_answer import FinalAnswerTool as FinalAnswer
12
-
13
-
14
 
 
15
  model = InferenceClientModel(
16
- model='Qwen/Qwen2.5-Coder-32B-Instruct',
17
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
 
18
  )
19
 
20
- web_search = WebSearch()
21
- final_answer = FinalAnswer()
22
-
23
-
24
- with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:
25
- prompt_templates = yaml.safe_load(stream)
26
-
27
  agent = CodeAgent(
28
  model=model,
29
- tools=[web_search],
30
- managed_agents=[],
31
-
32
  max_steps=20,
33
  verbosity_level=1,
34
- grammar=None,
35
- planning_interval=None,
36
- name=None,
37
- description=None,
38
- executor_type='local',
39
- executor_kwargs={},
40
- max_print_outputs_length=None,
41
- prompt_templates=prompt_templates
42
  )
 
 
43
  if __name__ == "__main__":
44
- GradioUI(agent).launch()
 
 
1
  import os
 
 
2
  from smolagents import GradioUI, CodeAgent, InferenceClientModel
3
 
4
+ # Load the API key
5
+ api_key = os.getenv('WingTokenAll')
 
 
 
 
 
6
 
7
+ # Initialize the model with the API key
8
  model = InferenceClientModel(
9
+ model='Qwen/Qwen2.5-Coder-32B-Instruct',
10
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
11
+ use_auth_token=api_key # Pass the API key here
12
  )
13
 
14
+ # Initialize the CodeAgent
 
 
 
 
 
 
15
  agent = CodeAgent(
16
  model=model,
17
+ tools=[], # Skip additional tools to speed up
 
 
18
  max_steps=20,
19
  verbosity_level=1,
 
 
 
 
 
 
 
 
20
  )
21
+
22
+ # Launch the Gradio UI
23
  if __name__ == "__main__":
24
+ GradioUI(agent).launch()