artintel235 commited on
Commit
c3bfb7c
·
verified ·
1 Parent(s): 4f29568

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
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(