Spaces:
Sleeping
Sleeping
Update app.py
Browse filesimplementar error para determinar por que no se genera la imagen
app.py
CHANGED
@@ -23,8 +23,11 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
23 |
elif arg2 == 2:
|
24 |
# Generate image using image generation tool
|
25 |
prompt = f"Generate an image based on the following input: {arg1}"
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
else:
|
29 |
return "Invalid argument for arg2. Use 1 for text generation and 2 for image generation."
|
30 |
|
|
|
23 |
elif arg2 == 2:
|
24 |
# Generate image using image generation tool
|
25 |
prompt = f"Generate an image based on the following input: {arg1}"
|
26 |
+
try:
|
27 |
+
image_response = image_generation_tool(prompt)
|
28 |
+
return f"Image generated: {image_response['image_url']}"
|
29 |
+
except Exception as e:
|
30 |
+
return f"Failed to generate image. Error: {str(e)}"
|
31 |
else:
|
32 |
return "Invalid argument for arg2. Use 1 for text generation and 2 for image generation."
|
33 |
|