Spaces:
Runtime error
Runtime error
update img tool
Browse files
app.py
CHANGED
@@ -24,13 +24,13 @@ def generate_image(prompt: str, style: str) -> str:
|
|
24 |
|
25 |
# Generate the image
|
26 |
image = image_generation_tool(full_prompt)
|
27 |
-
|
28 |
-
# Convert the image to
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
except Exception as e:
|
35 |
return f"Error generating image: {str(e)}"
|
36 |
|
|
|
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:
|
35 |
return f"Error generating image: {str(e)}"
|
36 |
|