lunarflu HF Staff commited on
Commit
ed4474d
·
1 Parent(s): ac9eb7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -35,7 +35,7 @@ async def on_ready():
35
  async def wuerstchen_command(ctx, prompt: str):
36
  """Wuerstchen generation"""
37
  try:
38
- await run_wuerstchen(ctx, prompt, client)
39
  except Exception as e:
40
  print(f"Error wuerstchen: (app.py){e}")
41
 
@@ -69,20 +69,18 @@ def wuerstchen_inference(prompt):
69
  return png_file[0]
70
 
71
 
72
- async def run_wuerstchen(ctx, prompt, client):
73
  """Responds to /Wuerstchen command"""
74
  try:
75
- if ctx.author.id != BOT_USER_ID:
76
- if ctx.channel.id == WUERSTCHEN_CHANNEL_ID:
77
- channel = client.get_channel(WUERSTCHEN_CHANNEL_ID)
78
- message = await ctx.send(f"**{prompt}** - {ctx.author.mention} <a:loading:1114111677990981692>")
79
 
80
- loop = asyncio.get_running_loop()
81
- result_path = await loop.run_in_executor(None, wuerstchen_inference, prompt)
82
 
83
- await message.delete()
84
- with open(result_path, "rb") as f:
85
- await channel.send(f"**{prompt}** - {ctx.author.mention}", file=discord.File(f, "wuerstchen.png"))
86
  except Exception as e:
87
  print(f"Error: {e}")
88
 
 
35
  async def wuerstchen_command(ctx, prompt: str):
36
  """Wuerstchen generation"""
37
  try:
38
+ await run_wuerstchen(ctx, prompt)
39
  except Exception as e:
40
  print(f"Error wuerstchen: (app.py){e}")
41
 
 
69
  return png_file[0]
70
 
71
 
72
+ async def run_wuerstchen(ctx, prompt):
73
  """Responds to /Wuerstchen command"""
74
  try:
75
+ channel = bot.get_channel(WUERSTCHEN_CHANNEL_ID)
76
+ message = await ctx.send(f"**{prompt}** - {ctx.author.mention} <a:loading:1114111677990981692>")
 
 
77
 
78
+ loop = asyncio.get_running_loop()
79
+ result_path = await loop.run_in_executor(None, wuerstchen_inference, prompt)
80
 
81
+ await message.delete()
82
+ with open(result_path, "rb") as f:
83
+ await channel.send(f"**{prompt}** - {ctx.author.mention}", file=discord.File(f, "wuerstchen.png"))
84
  except Exception as e:
85
  print(f"Error: {e}")
86