lunarflu HF Staff commited on
Commit
cef3448
·
1 Parent(s): 940edd3

[dfif] hunting bugs

Browse files
Files changed (1) hide show
  1. app.py +9 -17
app.py CHANGED
@@ -411,6 +411,7 @@ async def deepfloydif(ctx, *, prompt: str):
411
  png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
412
 
413
  if png_files:
 
414
  first_png = png_files[0]
415
  second_png = png_files[1]
416
  third_png = png_files[2]
@@ -420,25 +421,25 @@ async def deepfloydif(ctx, *, prompt: str):
420
  second_png_path = os.path.join(stage_1_results, second_png)
421
  third_png_path = os.path.join(stage_1_results, third_png)
422
  fourth_png_path = os.path.join(stage_1_results, fourth_png)
423
-
424
  img1 = Image.open(first_png_path)
425
  img2 = Image.open(second_png_path)
426
  img3 = Image.open(third_png_path)
427
  img4 = Image.open(fourth_png_path)
428
 
429
  combined_image = Image.new('RGB', (img1.width * 2, img1.height * 2))
430
-
431
  combined_image.paste(img1, (0, 0))
432
  combined_image.paste(img2, (img1.width, 0))
433
  combined_image.paste(img3, (0, img1.height))
434
  combined_image.paste(img4, (img1.width, img1.height))
435
-
436
  combined_image_path = os.path.join(stage_1_results, f'{partialpath}{dfif_command_message_id}.png')
437
  combined_image.save(combined_image_path)
438
-
439
- with open(combined_image_path, 'rb') as f:
440
- combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
441
- f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
442
 
443
  await thread.send(f'✅reacting with 1234...')
444
  emoji_list = ['↖️', '↗️', '↙️', '↘️']
@@ -456,16 +457,7 @@ async def deepfloydif(ctx, *, prompt: str):
456
  await asyncio.sleep(1)
457
 
458
  '''
459
-
460
- except Exception as e:
461
- print(f"Error: {e}")
462
- if thread is None:
463
- thread = await ctx.message.create_thread(name=f'Posting Error')
464
- await thread.send(f"{ctx.author.mention} Encountered error while posting combined image in thread, {e}")
465
- await fullqueue(e, thread)
466
- await ctx.message.remove_reaction('<a:loading:1114111677990981692>', bot.user)
467
- await ctx.message.add_reaction('<:disagree:1098628957521313892>')
468
- await thread.edit(archived=True)
469
  #deepfloydif try/except
470
  except Exception as e:
471
  print(f"Error: {e}")
 
411
  png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
412
 
413
  if png_files:
414
+ await thread.send('png files exists, combining images...')
415
  first_png = png_files[0]
416
  second_png = png_files[1]
417
  third_png = png_files[2]
 
421
  second_png_path = os.path.join(stage_1_results, second_png)
422
  third_png_path = os.path.join(stage_1_results, third_png)
423
  fourth_png_path = os.path.join(stage_1_results, fourth_png)
424
+ await thread.send('defining images...')
425
  img1 = Image.open(first_png_path)
426
  img2 = Image.open(second_png_path)
427
  img3 = Image.open(third_png_path)
428
  img4 = Image.open(fourth_png_path)
429
 
430
  combined_image = Image.new('RGB', (img1.width * 2, img1.height * 2))
431
+ await thread.send('pasting images...')
432
  combined_image.paste(img1, (0, 0))
433
  combined_image.paste(img2, (img1.width, 0))
434
  combined_image.paste(img3, (0, img1.height))
435
  combined_image.paste(img4, (img1.width, img1.height))
436
+ await thread.send('saving combined image...')
437
  combined_image_path = os.path.join(stage_1_results, f'{partialpath}{dfif_command_message_id}.png')
438
  combined_image.save(combined_image_path)
439
+ await thread.send('before posting combined image in thread...')
440
+ with open(combined_image_path, 'rb') as f:
441
+ combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
442
+ f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
443
 
444
  await thread.send(f'✅reacting with 1234...')
445
  emoji_list = ['↖️', '↗️', '↙️', '↘️']
 
457
  await asyncio.sleep(1)
458
 
459
  '''
460
+ z
 
 
 
 
 
 
 
 
 
461
  #deepfloydif try/except
462
  except Exception as e:
463
  print(f"Error: {e}")