AiWicked commited on
Commit
5ed6f3b
·
verified ·
1 Parent(s): 1ce23aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -1,10 +1,9 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
  import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
-
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
@@ -79,7 +78,25 @@ def generate_keywords(topic: str, num_keywords: int) -> str:
79
 
80
  return response
81
 
82
- # Правильное создание агента
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  agent = CodeAgent(
84
  model,
85
  [
@@ -98,5 +115,4 @@ agent = CodeAgent(
98
  prompt_templates=prompt_templates
99
  )
100
 
101
-
102
  GradioUI(agent).launch()
 
1
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
2
  import datetime
3
  import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
  from Gradio_UI import GradioUI
8
 
9
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
78
 
79
  return response
80
 
81
+ # Initialize components
82
+ final_answer = FinalAnswerTool()
83
+
84
+ # Model initialization
85
+ model = HfApiModel(
86
+ max_tokens=2096,
87
+ temperature=0.5,
88
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
89
+ custom_role_conversions=None,
90
+ )
91
+
92
+ # Load tool from Hub
93
+ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
94
+
95
+ # Load prompt templates
96
+ with open("prompts.yaml", 'r') as stream:
97
+ prompt_templates = yaml.safe_load(stream)
98
+
99
+ # Create agent
100
  agent = CodeAgent(
101
  model,
102
  [
 
115
  prompt_templates=prompt_templates
116
  )
117
 
 
118
  GradioUI(agent).launch()