Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,8 @@ from tools.final_answer import FinalAnswerTool
|
|
| 7 |
import PIL
|
| 8 |
from PIL import Image
|
| 9 |
from typing import Any, Optional
|
|
|
|
|
|
|
| 10 |
|
| 11 |
from Gradio_UI import GradioUI
|
| 12 |
|
|
@@ -23,7 +25,8 @@ def my_custom_tool(arg1:str, img: bool)-> Any: #it's import to specify the retur
|
|
| 23 |
if img:
|
| 24 |
# Import tool from Hub
|
| 25 |
image_generation_tool = load_tool("dwb2023/text-to-image", trust_remote_code=True)
|
| 26 |
-
image_generation_tool(arg1)
|
|
|
|
| 27 |
else:
|
| 28 |
search_obj = DuckDuckGoSearchTool()
|
| 29 |
answer = search_obj(arg1)
|
|
@@ -61,14 +64,14 @@ custom_role_conversions=None,
|
|
| 61 |
|
| 62 |
|
| 63 |
# # Import tool from Hub
|
| 64 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 65 |
|
| 66 |
with open("prompts.yaml", 'r') as stream:
|
| 67 |
prompt_templates = yaml.safe_load(stream)
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
-
tools=[final_answer,my_custom_tool,
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|
|
|
|
| 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 |
|
|
|
|
| 25 |
if img:
|
| 26 |
# Import tool from Hub
|
| 27 |
image_generation_tool = load_tool("dwb2023/text-to-image", trust_remote_code=True)
|
| 28 |
+
#image_generation_tool(arg1)
|
| 29 |
+
launch_gradio_demo(image_generation_tool(arg1))
|
| 30 |
else:
|
| 31 |
search_obj = DuckDuckGoSearchTool()
|
| 32 |
answer = search_obj(arg1)
|
|
|
|
| 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,
|