Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -80,8 +80,14 @@ async def generate_command(
|
|
80 |
prompt: str,
|
81 |
aspect_ratio: app_commands.Choice[str],
|
82 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
"""Generates an image based on the user's prompt and aspect ratio."""
|
84 |
-
await interaction.response.defer() # Acknowledge within 3 seconds
|
85 |
|
86 |
# Call the asynchronous image generation function
|
87 |
image_url_or_error = await generate_image_async(
|
|
|
80 |
prompt: str,
|
81 |
aspect_ratio: app_commands.Choice[str],
|
82 |
):
|
83 |
+
try:
|
84 |
+
await interaction.response.defer() # MUST be the first await
|
85 |
+
|
86 |
+
# ... rest of your code ...
|
87 |
+
except Exception as e:
|
88 |
+
print(e)
|
89 |
"""Generates an image based on the user's prompt and aspect ratio."""
|
90 |
+
# await interaction.response.defer() # Acknowledge within 3 seconds
|
91 |
|
92 |
# Call the asynchronous image generation function
|
93 |
image_url_or_error = await generate_image_async(
|