Spaces:
Runtime error
Runtime error
Tushar Rohilla commited on
Commit ·
41e6990
1
Parent(s): 1cde42c
type
Browse files
app.py
CHANGED
|
@@ -6,6 +6,8 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
import os
|
| 8 |
from Gradio_UI import GradioUI
|
|
|
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
|
@@ -53,14 +55,14 @@ custom_role_conversions=None,
|
|
| 53 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 54 |
|
| 55 |
@tool
|
| 56 |
-
def generate_image(prompt: str):
|
| 57 |
"""Generates an image from a text prompt using a Hugging Face remote tool.
|
| 58 |
|
| 59 |
Args:
|
| 60 |
prompt: The text description of the image to generate.
|
| 61 |
|
| 62 |
Returns:
|
| 63 |
-
The generated image.
|
| 64 |
"""
|
| 65 |
return image_generation_tool(prompt)
|
| 66 |
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
import os
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
+
from typing import Any
|
| 10 |
+
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
|
|
|
| 55 |
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
| 56 |
|
| 57 |
@tool
|
| 58 |
+
def generate_image(prompt: str) -> Any: # Explicitly define return type
|
| 59 |
"""Generates an image from a text prompt using a Hugging Face remote tool.
|
| 60 |
|
| 61 |
Args:
|
| 62 |
prompt: The text description of the image to generate.
|
| 63 |
|
| 64 |
Returns:
|
| 65 |
+
The generated image (depends on the tool's return format).
|
| 66 |
"""
|
| 67 |
return image_generation_tool(prompt)
|
| 68 |
|