Update app.py
Browse files
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
|
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
|
73 |
"""Responds to /Wuerstchen command"""
|
74 |
try:
|
75 |
-
|
76 |
-
|
77 |
-
channel = client.get_channel(WUERSTCHEN_CHANNEL_ID)
|
78 |
-
message = await ctx.send(f"**{prompt}** - {ctx.author.mention} <a:loading:1114111677990981692>")
|
79 |
|
80 |
-
|
81 |
-
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
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 |
|