WingNeville commited on
Commit
7b677d5
·
verified ·
1 Parent(s): 4338821

Update app.py

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