Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
# Imports
|
2 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
|
|
3 |
import datetime
|
4 |
import requests
|
5 |
import pytz
|
@@ -7,7 +7,6 @@ import yaml
|
|
7 |
from tools.final_answer import FinalAnswerTool
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
-
# Tool definitions
|
11 |
@tool
|
12 |
def generate_keywords(topic: str, num_keywords: int) -> str:
|
13 |
"""A tool that generates relevant keywords for a given topic
|
@@ -73,11 +72,10 @@ image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_co
|
|
73 |
with open("prompts.yaml", 'r') as stream:
|
74 |
prompt_templates = yaml.safe_load(stream)
|
75 |
|
76 |
-
# Create agent
|
77 |
agent = CodeAgent(
|
78 |
tools=[
|
79 |
image_generation_tool,
|
80 |
-
get_current_time_in_timezone,
|
81 |
generate_keywords,
|
82 |
final_answer,
|
83 |
DuckDuckGoSearchTool()
|
|
|
|
|
1 |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
2 |
+
from smolagents.tools import tooldef # Добавляем этот импорт
|
3 |
import datetime
|
4 |
import requests
|
5 |
import pytz
|
|
|
7 |
from tools.final_answer import FinalAnswerTool
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
|
|
10 |
@tool
|
11 |
def generate_keywords(topic: str, num_keywords: int) -> str:
|
12 |
"""A tool that generates relevant keywords for a given topic
|
|
|
72 |
with open("prompts.yaml", 'r') as stream:
|
73 |
prompt_templates = yaml.safe_load(stream)
|
74 |
|
75 |
+
# Create agent
|
76 |
agent = CodeAgent(
|
77 |
tools=[
|
78 |
image_generation_tool,
|
|
|
79 |
generate_keywords,
|
80 |
final_answer,
|
81 |
DuckDuckGoSearchTool()
|