Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,6 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
import PIL
|
| 8 |
from PIL import Image
|
| 9 |
from typing import Any, Optional
|
| 10 |
-
#from tool import TextToImageTool
|
| 11 |
-
#from transformers import launch_gradio_demo
|
| 12 |
|
| 13 |
#from Gradio_UI import GradioUI
|
| 14 |
from smolagents import GradioUI
|
|
@@ -20,7 +18,7 @@ def my_custom_tool(arg1:str, img: bool)-> Any: #it's import to specify the retur
|
|
| 20 |
"""A tool that uses 'DuckDuckGoSearchTool' tool to answer any query and 'image_generation_tool' tool to generate image.
|
| 21 |
Args:
|
| 22 |
arg1: string query to be used to search answer via given search tool.
|
| 23 |
-
img: boolean value in TRUE/FALSE if TRUE then arg1 as prompt for generating image.
|
| 24 |
"""
|
| 25 |
try:
|
| 26 |
if img:
|
|
@@ -66,14 +64,14 @@ custom_role_conversions=None,
|
|
| 66 |
|
| 67 |
|
| 68 |
# # Import tool from Hub
|
| 69 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 70 |
|
| 71 |
with open("prompts.yaml", 'r') as stream:
|
| 72 |
prompt_templates = yaml.safe_load(stream)
|
| 73 |
|
| 74 |
agent = CodeAgent(
|
| 75 |
model=model,
|
| 76 |
-
tools=[final_answer,my_custom_tool,
|
| 77 |
max_steps=6,
|
| 78 |
verbosity_level=1,
|
| 79 |
grammar=None,
|
|
|
|
| 7 |
import PIL
|
| 8 |
from PIL import Image
|
| 9 |
from typing import Any, Optional
|
|
|
|
|
|
|
| 10 |
|
| 11 |
#from Gradio_UI import GradioUI
|
| 12 |
from smolagents import GradioUI
|
|
|
|
| 18 |
"""A tool that uses 'DuckDuckGoSearchTool' tool to answer any query and 'image_generation_tool' tool to generate image.
|
| 19 |
Args:
|
| 20 |
arg1: string query to be used to search answer via given search tool.
|
| 21 |
+
img: boolean value in TRUE/FALSE if TRUE then use `arg1` as prompt for generating image.
|
| 22 |
"""
|
| 23 |
try:
|
| 24 |
if img:
|
|
|
|
| 64 |
|
| 65 |
|
| 66 |
# # Import tool from Hub
|
| 67 |
+
#image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 68 |
|
| 69 |
with open("prompts.yaml", 'r') as stream:
|
| 70 |
prompt_templates = yaml.safe_load(stream)
|
| 71 |
|
| 72 |
agent = CodeAgent(
|
| 73 |
model=model,
|
| 74 |
+
tools=[final_answer,my_custom_tool,get_current_time_in_timezone], ## add your tools here (don't remove final answer)
|
| 75 |
max_steps=6,
|
| 76 |
verbosity_level=1,
|
| 77 |
grammar=None,
|