Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -11,8 +11,7 @@ from Gradio_UI import GradioUI
|
|
11 |
|
12 |
|
13 |
@tool
|
14 |
-
|
15 |
-
def generate_image(prompt: str, style: str) -> PIL.Image.Image:
|
16 |
"""A tool that generates an image based on a prompt and a style.
|
17 |
Args:
|
18 |
prompt: the prompt to generate the image
|
@@ -24,11 +23,11 @@ def generate_image(prompt: str, style: str) -> PIL.Image.Image:
|
|
24 |
|
25 |
# Generate the image
|
26 |
image = image_generation_tool(full_prompt)
|
27 |
-
|
28 |
# Convert the PIL image to AgentImage
|
29 |
from smolagents.agent_types import AgentImage
|
30 |
agent_image = AgentImage(image)
|
31 |
-
|
32 |
# Return the AgentImage object
|
33 |
return agent_image
|
34 |
except Exception as e:
|
|
|
11 |
|
12 |
|
13 |
@tool
|
14 |
+
def generate_image(prompt: str, style: str) -> str:
|
|
|
15 |
"""A tool that generates an image based on a prompt and a style.
|
16 |
Args:
|
17 |
prompt: the prompt to generate the image
|
|
|
23 |
|
24 |
# Generate the image
|
25 |
image = image_generation_tool(full_prompt)
|
26 |
+
|
27 |
# Convert the PIL image to AgentImage
|
28 |
from smolagents.agent_types import AgentImage
|
29 |
agent_image = AgentImage(image)
|
30 |
+
|
31 |
# Return the AgentImage object
|
32 |
return agent_image
|
33 |
except Exception as e:
|