wop commited on
Commit
6c0d1fd
1 Parent(s): 44fa152

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -13,6 +13,7 @@ from discord import Permissions
13
  from discord.ext import commands
14
  from discord.utils import oauth_url
15
  from gradio_client.utils import QueueError
 
16
 
17
  event = Event()
18
 
@@ -80,10 +81,11 @@ def query(prompt):
80
  @bot.command()
81
  async def img(ctx, *, prompt: str):
82
  # Query the API to generate the image
83
- image_data = query(prompt)
 
84
 
85
- # Encode image data as base64
86
- image_b64 = base64.b64encode(image_data).decode('utf-8')
87
 
88
  # Send the image as a file
89
  await ctx.send(file=discord.File(base64.b64decode(image_b64), filename="generated_image.png"))
 
13
  from discord.ext import commands
14
  from discord.utils import oauth_url
15
  from gradio_client.utils import QueueError
16
+ import base64
17
 
18
  event = Event()
19
 
 
81
  @bot.command()
82
  async def img(ctx, *, prompt: str):
83
  # Query the API to generate the image
84
+ async with ctx.typing():
85
+ image_data = query(prompt)
86
 
87
+ # Encode image data as base64
88
+ image_b64 = base64.b64encode(image_data).decode('utf-8')
89
 
90
  # Send the image as a file
91
  await ctx.send(file=discord.File(base64.b64decode(image_b64), filename="generated_image.png"))