lunarflu HF Staff commited on
Commit
74e59ca
Β·
1 Parent(s): 051544e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -12
app.py CHANGED
@@ -163,6 +163,7 @@ async def jojo(ctx):
163
  try:
164
  if await safetychecks(ctx): #βœ…
165
  await ctx.message.add_reaction('πŸ€–')
 
166
  thread = await ctx.message.create_thread(name=f'{ctx.author} Jojo Thread')
167
  if ctx.message.attachments:
168
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...yare yare, daze ...')
@@ -175,11 +176,13 @@ async def jojo(ctx):
175
  await ctx.message.add_reaction('βœ…') # img + face
176
  else: # no image
177
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
178
- await ctx.message.add_reaction('❌')
 
179
  except Exception as e: # no generation / img + no face
180
  print(f"Error: {e}")
181
  await thread.send(f"{ctx.author.mention}Error: {e}")
182
- await ctx.message.add_reaction('❌')
 
183
 
184
  #----------------------------------------------------------------------------------------------------------------------------------------------
185
  # Disney ❌
@@ -187,7 +190,8 @@ async def jojo(ctx):
187
  async def disney(ctx):
188
  try:
189
  if await safetychecks(ctx): #βœ…
190
- await ctx.message.add_reaction('πŸ€–')
 
191
  thread = await ctx.message.create_thread(name=f'{ctx.author} disney Thread')
192
  if ctx.message.attachments:
193
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
@@ -198,11 +202,13 @@ async def disney(ctx):
198
  await ctx.message.add_reaction('βœ…') # img + face
199
  else: # no image
200
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
201
- await ctx.message.add_reaction('❌')
 
202
  except Exception as e: # no generation / img + no face
203
  print(f"Error: {e}")
204
  await thread.send(f"{ctx.author.mention}Error: {e}")
205
  await ctx.message.add_reaction('❌')
 
206
 
207
  #----------------------------------------------------------------------------------------------------------------------------------------------
208
  # Spider-Verse βœ…
@@ -211,6 +217,7 @@ async def spidey(ctx):
211
  try:
212
  if await safetychecks(ctx): #βœ…
213
  await ctx.message.add_reaction('πŸ€–')
 
214
  thread = await ctx.message.create_thread(name=f'{ctx.author} spider-verse Thread')
215
  if ctx.message.attachments:
216
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
@@ -221,11 +228,13 @@ async def spidey(ctx):
221
  await ctx.message.add_reaction('βœ…') # img + face
222
  else: # no image
223
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
224
- await ctx.message.add_reaction('❌')
 
225
  except Exception as e: # no generation / img + no face
226
  print(f"Error: {e}")
227
  await thread.send(f"{ctx.author.mention}Error: {e}")
228
  await ctx.message.add_reaction('❌')
 
229
 
230
  #----------------------------------------------------------------------------------------------------------------------------------------------
231
  # sketch βœ…
@@ -234,6 +243,7 @@ async def sketch(ctx):
234
  try:
235
  if await safetychecks(ctx): #βœ…
236
  await ctx.message.add_reaction('πŸ€–')
 
237
  thread = await ctx.message.create_thread(name=f'{ctx.author} sketch Thread')
238
  if ctx.message.attachments:
239
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
@@ -244,11 +254,13 @@ async def sketch(ctx):
244
  await ctx.message.add_reaction('βœ…') # img + face
245
  else: # no image
246
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
247
- await ctx.message.add_reaction('❌')
 
248
  except Exception as e: # no generation / img + no face
249
  print(f"Error: {e}")
250
  await thread.send(f"{ctx.author.mention}Error: {e}")
251
  await ctx.message.add_reaction('❌')
 
252
  #----------------------------------------------------------------------------------------------------------------------------------------------
253
  # deepfloydif stage 1 generation βœ…
254
  def inference(prompt):
@@ -314,7 +326,7 @@ async def deepfloydif(ctx, *, prompt: str):
314
  print(f"Error: {e}")
315
  thread = await ctx.message.create_thread(name=f'DFIF1 Error')
316
  await thread.send(f"{ctx.author.mention} Error during stage 1 pre-generation.")
317
- await ctx.message.remove_reaction('⏳')
318
  await ctx.message.add_reaction(failure_emoji)
319
 
320
  #generationβœ…-------------------------------------------------------
@@ -336,7 +348,7 @@ async def deepfloydif(ctx, *, prompt: str):
336
  print(f"Error: {e}")
337
  thread = await ctx.message.create_thread(name=f'Generation Error')
338
  await thread.send(f"{ctx.author.mention} Error during stage 1 generation.")
339
- await ctx.message.remove_reaction('⏳')
340
  await ctx.message.add_reaction(failure_emoji)
341
  #posting imagesβœ…----------------------------------------------------------------
342
  try:
@@ -394,7 +406,7 @@ async def deepfloydif(ctx, *, prompt: str):
394
  print(f"Error: {e}")
395
  thread = await ctx.message.create_thread(name=f'Posting Error')
396
  await thread.send(f"{ctx.author.mention} Encountered error while posting combined image in thread.")
397
- await ctx.message.remove_reaction('⏳')
398
  await ctx.message.add_reaction(failure_emoji)
399
 
400
  #deepfloydif try/except
@@ -402,7 +414,7 @@ async def deepfloydif(ctx, *, prompt: str):
402
  print(f"Error: {e}")
403
  thread = await ctx.message.create_thread(name=f'deepfloydif Error')
404
  await thread.send(f"{ctx.author.mention} Overall error with deepfloydif.")
405
- await ctx.message.remove_reaction('⏳')
406
  await ctx.message.add_reaction(failure_emoji)
407
 
408
  #----------------------------------------------------------------------------------------------------------------------------
@@ -427,7 +439,7 @@ async def dfif2(index: int, stage_1_result_path, thread, dfif_command_message_id
427
  parent_channel = thread.parent
428
  dfif_command_message = await parent_channel.fetch_message(dfif_command_message_id)
429
  await dfif_command_message.add_reaction(success_emoji)
430
- await dfif_command_message.remove_reaction('⏳')
431
 
432
  except Exception as e:
433
  print(f"Error: {e}")
@@ -438,7 +450,7 @@ async def dfif2(index: int, stage_1_result_path, thread, dfif_command_message_id
438
  parent_channel = thread.parent
439
  dfif_command_message = await parent_channel.fetch_message(dfif_command_message_id)
440
  await dfif_command_message.add_reaction(failure_emoji)
441
- await dfif_command_message.remove_reaction('⏳')
442
  await thread.send(f"Error during stage 2 upscaling.")
443
  #----------------------------------------------------------------------------------------------------------------------------
444
  # react detector for stage 2 βœ…
 
163
  try:
164
  if await safetychecks(ctx): #βœ…
165
  await ctx.message.add_reaction('πŸ€–')
166
+ await ctx.message.add_reaction('⏳')
167
  thread = await ctx.message.create_thread(name=f'{ctx.author} Jojo Thread')
168
  if ctx.message.attachments:
169
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...yare yare, daze ...')
 
176
  await ctx.message.add_reaction('βœ…') # img + face
177
  else: # no image
178
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
179
+ await ctx.message.add_reaction('❌')
180
+ await ctx.message.remove_reaction('⏳', bot.user)
181
  except Exception as e: # no generation / img + no face
182
  print(f"Error: {e}")
183
  await thread.send(f"{ctx.author.mention}Error: {e}")
184
+ await ctx.message.add_reaction('❌')
185
+ await ctx.message.remove_reaction('⏳', bot.user)
186
 
187
  #----------------------------------------------------------------------------------------------------------------------------------------------
188
  # Disney ❌
 
190
  async def disney(ctx):
191
  try:
192
  if await safetychecks(ctx): #βœ…
193
+ await ctx.message.add_reaction('πŸ€–')
194
+ await ctx.message.add_reaction('⏳')
195
  thread = await ctx.message.create_thread(name=f'{ctx.author} disney Thread')
196
  if ctx.message.attachments:
197
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
 
202
  await ctx.message.add_reaction('βœ…') # img + face
203
  else: # no image
204
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
205
+ await ctx.message.add_reaction('❌')
206
+ await ctx.message.remove_reaction('⏳', bot.user)
207
  except Exception as e: # no generation / img + no face
208
  print(f"Error: {e}")
209
  await thread.send(f"{ctx.author.mention}Error: {e}")
210
  await ctx.message.add_reaction('❌')
211
+ await ctx.message.remove_reaction('⏳', bot.user)
212
 
213
  #----------------------------------------------------------------------------------------------------------------------------------------------
214
  # Spider-Verse βœ…
 
217
  try:
218
  if await safetychecks(ctx): #βœ…
219
  await ctx.message.add_reaction('πŸ€–')
220
+ await ctx.message.add_reaction('⏳')
221
  thread = await ctx.message.create_thread(name=f'{ctx.author} spider-verse Thread')
222
  if ctx.message.attachments:
223
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
 
228
  await ctx.message.add_reaction('βœ…') # img + face
229
  else: # no image
230
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
231
+ await ctx.message.add_reaction('❌')
232
+ await ctx.message.remove_reaction('⏳', bot.user)
233
  except Exception as e: # no generation / img + no face
234
  print(f"Error: {e}")
235
  await thread.send(f"{ctx.author.mention}Error: {e}")
236
  await ctx.message.add_reaction('❌')
237
+ await ctx.message.remove_reaction('⏳', bot.user)
238
 
239
  #----------------------------------------------------------------------------------------------------------------------------------------------
240
  # sketch βœ…
 
243
  try:
244
  if await safetychecks(ctx): #βœ…
245
  await ctx.message.add_reaction('πŸ€–')
246
+ await ctx.message.add_reaction('⏳')
247
  thread = await ctx.message.create_thread(name=f'{ctx.author} sketch Thread')
248
  if ctx.message.attachments:
249
  await thread.send(f'{ctx.author.mention}Generating images in thread, can take ~1 minute...')
 
254
  await ctx.message.add_reaction('βœ…') # img + face
255
  else: # no image
256
  await thread.send(f"{ctx.author.mention}No attachments to be found...Can't animify dat! Try sending me an image πŸ˜‰")
257
+ await ctx.message.add_reaction('❌')
258
+ await ctx.message.remove_reaction('⏳', bot.user)
259
  except Exception as e: # no generation / img + no face
260
  print(f"Error: {e}")
261
  await thread.send(f"{ctx.author.mention}Error: {e}")
262
  await ctx.message.add_reaction('❌')
263
+ await ctx.message.remove_reaction('⏳', bot.user)
264
  #----------------------------------------------------------------------------------------------------------------------------------------------
265
  # deepfloydif stage 1 generation βœ…
266
  def inference(prompt):
 
326
  print(f"Error: {e}")
327
  thread = await ctx.message.create_thread(name=f'DFIF1 Error')
328
  await thread.send(f"{ctx.author.mention} Error during stage 1 pre-generation.")
329
+ await ctx.message.remove_reaction('⏳', bot.user)
330
  await ctx.message.add_reaction(failure_emoji)
331
 
332
  #generationβœ…-------------------------------------------------------
 
348
  print(f"Error: {e}")
349
  thread = await ctx.message.create_thread(name=f'Generation Error')
350
  await thread.send(f"{ctx.author.mention} Error during stage 1 generation.")
351
+ await ctx.message.remove_reaction('⏳', bot.user)
352
  await ctx.message.add_reaction(failure_emoji)
353
  #posting imagesβœ…----------------------------------------------------------------
354
  try:
 
406
  print(f"Error: {e}")
407
  thread = await ctx.message.create_thread(name=f'Posting Error')
408
  await thread.send(f"{ctx.author.mention} Encountered error while posting combined image in thread.")
409
+ await ctx.message.remove_reaction('⏳', bot.user)
410
  await ctx.message.add_reaction(failure_emoji)
411
 
412
  #deepfloydif try/except
 
414
  print(f"Error: {e}")
415
  thread = await ctx.message.create_thread(name=f'deepfloydif Error')
416
  await thread.send(f"{ctx.author.mention} Overall error with deepfloydif.")
417
+ await ctx.message.remove_reaction('⏳', bot.user)
418
  await ctx.message.add_reaction(failure_emoji)
419
 
420
  #----------------------------------------------------------------------------------------------------------------------------
 
439
  parent_channel = thread.parent
440
  dfif_command_message = await parent_channel.fetch_message(dfif_command_message_id)
441
  await dfif_command_message.add_reaction(success_emoji)
442
+ await dfif_command_message.remove_reaction('⏳', bot.user)
443
 
444
  except Exception as e:
445
  print(f"Error: {e}")
 
450
  parent_channel = thread.parent
451
  dfif_command_message = await parent_channel.fetch_message(dfif_command_message_id)
452
  await dfif_command_message.add_reaction(failure_emoji)
453
+ await dfif_command_message.remove_reaction('⏳', bot.user)
454
  await thread.send(f"Error during stage 2 upscaling.")
455
  #----------------------------------------------------------------------------------------------------------------------------
456
  # react detector for stage 2 βœ