Spaces:
Runtime error
Runtime error
Update app.py
Browse filesGet rid of launch_gradio, change return type to str
app.py
CHANGED
@@ -5,7 +5,6 @@ import pytz
|
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
from PIL import Image
|
8 |
-
from transformers import launch_gradio_demo
|
9 |
|
10 |
|
11 |
launch_gradio_demo(TextToImageTool)
|
@@ -56,7 +55,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
56 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
57 |
|
58 |
@tool
|
59 |
-
def generate_image(description: str) ->
|
60 |
"""A tool that generates an image from a text description.
|
61 |
Args:
|
62 |
description: A string representing the text description to generate an image of.
|
@@ -69,7 +68,7 @@ def generate_image(description: str) -> Image:
|
|
69 |
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
70 |
image = image_generation_tool(description)
|
71 |
# return f"Image generated for prompt: {description}."
|
72 |
-
return
|
73 |
|
74 |
|
75 |
|
|
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
from PIL import Image
|
|
|
8 |
|
9 |
|
10 |
launch_gradio_demo(TextToImageTool)
|
|
|
55 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
56 |
|
57 |
@tool
|
58 |
+
def generate_image(description: str) -> str:
|
59 |
"""A tool that generates an image from a text description.
|
60 |
Args:
|
61 |
description: A string representing the text description to generate an image of.
|
|
|
68 |
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
69 |
image = image_generation_tool(description)
|
70 |
# return f"Image generated for prompt: {description}."
|
71 |
+
return image
|
72 |
|
73 |
|
74 |
|