Spaces:
Runtime error
Runtime error
Update app.py
Browse filestry returning an image
app.py
CHANGED
|
@@ -52,19 +52,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 52 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 53 |
|
| 54 |
@tool
|
| 55 |
-
def generate_image(description: str) ->
|
| 56 |
"""A tool that generates an image from a text description.
|
| 57 |
Args:
|
| 58 |
description: A string representing the text description to generate an image of.
|
| 59 |
"""
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 66 |
image = image_generation_tool(description)
|
| 67 |
-
return f"Image generated for prompt: {description}."
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
|
|
|
|
| 52 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 53 |
|
| 54 |
@tool
|
| 55 |
+
def generate_image(description: str) -> Image:
|
| 56 |
"""A tool that generates an image from a text description.
|
| 57 |
Args:
|
| 58 |
description: A string representing the text description to generate an image of.
|
| 59 |
"""
|
| 60 |
+
image_generation_tool = Tool.from_space(
|
| 61 |
+
"black-forest-labs/FLUX.1-schnell",
|
| 62 |
+
name="image_generator",
|
| 63 |
+
description="Generate an image from a prompt"
|
| 64 |
+
)
|
| 65 |
+
# image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 66 |
image = image_generation_tool(description)
|
| 67 |
+
# return f"Image generated for prompt: {description}."
|
| 68 |
+
return image
|
| 69 |
|
| 70 |
|
| 71 |
|