Spaces:
Sleeping
Sleeping
add imagegen tool
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
@@ -9,9 +9,14 @@ from duckduckgo_search import DDGS
|
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
@tool
|
| 14 |
-
def
|
| 15 |
|
| 16 |
"""A tool that make web searches to find relevant information to answer the input query
|
| 17 |
Args:
|
|
@@ -57,7 +62,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[final_answer,
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 1 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool, tool, Tool
|
| 2 |
import datetime
|
| 3 |
import requests
|
| 4 |
import pytz
|
|
|
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
+
image_generation_tool = Tool.from_space(
|
| 13 |
+
"black-forest-labs/FLUX.1-schnell",
|
| 14 |
+
name="image_generator",
|
| 15 |
+
description="Generate an image from a prompt"
|
| 16 |
+
)
|
| 17 |
|
| 18 |
@tool
|
| 19 |
+
def search_web_myway(query:str)-> str: #it's import to specify the return type
|
| 20 |
|
| 21 |
"""A tool that make web searches to find relevant information to answer the input query
|
| 22 |
Args:
|
|
|
|
| 62 |
|
| 63 |
agent = CodeAgent(
|
| 64 |
model=model,
|
| 65 |
+
tools=[final_answer, search_web_myway, image_generation_tool], ## add your tools here (don't remove final answer)
|
| 66 |
max_steps=6,
|
| 67 |
verbosity_level=1,
|
| 68 |
grammar=None,
|