lunarflu HF Staff commited on
Commit
e998610
·
1 Parent(s): 6a11b53

[dfif1] await 1234, imports cleaned up

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -13,10 +13,7 @@ from discord.ext import commands
13
  from gradio_client import Client
14
  from PIL import Image
15
  #from ratelimiter import RateLimiter
16
- #
17
- from datetime import datetime
18
- from pytz import timezone
19
- #
20
  import asyncio
21
 
22
  import shutil # for doing image movement magic
@@ -24,6 +21,7 @@ import shutil # for doing image movement magic
24
  #todo
25
  # 4 -> combined image
26
  # loading emoji? animated emojis?
 
27
  # tasks for concurrent coroutines
28
  # ratelimits
29
 
@@ -261,8 +259,12 @@ async def deepfloydif(ctx, *, prompt: str):
261
  combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
262
  f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
263
 
264
- for emoji in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']:
265
- await combined_image_dfif.add_reaction(emoji)
 
 
 
 
266
  ''' individual images
267
  if png_files:
268
  for i, png_file in enumerate(png_files):
@@ -388,7 +390,8 @@ async def on_reaction_add(reaction, user): # ctx = await bot.get_context(reac
388
  elif emoji == "3️⃣":
389
  index = 2
390
  elif emoji == "4️⃣":
391
- index = 3
 
392
  await reaction.message.channel.send(f"index extracted, {index}")
393
  index = index
394
  stage_1_result_path = fullpath
 
13
  from gradio_client import Client
14
  from PIL import Image
15
  #from ratelimiter import RateLimiter
16
+
 
 
 
17
  import asyncio
18
 
19
  import shutil # for doing image movement magic
 
21
  #todo
22
  # 4 -> combined image
23
  # loading emoji? animated emojis?
24
+ # make success / fail emojis more consistent across both painter + dfif
25
  # tasks for concurrent coroutines
26
  # ratelimits
27
 
 
259
  combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
260
  f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
261
 
262
+ async def react1234(emoji, combined_image_dfif):
263
+ for emoji in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']:
264
+ await combined_image_dfif.add_reaction(emoji)
265
+
266
+ await react1234(emoji, combined_image_dfif)
267
+
268
  ''' individual images
269
  if png_files:
270
  for i, png_file in enumerate(png_files):
 
390
  elif emoji == "3️⃣":
391
  index = 2
392
  elif emoji == "4️⃣":
393
+ index = 3
394
+
395
  await reaction.message.channel.send(f"index extracted, {index}")
396
  index = index
397
  stage_1_result_path = fullpath