readded debugging due to error in [dfif]
Browse files
app.py
CHANGED
@@ -382,10 +382,11 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
382 |
# prompt, negative_prompt, seed, number_of_images, guidance_scale, custom_timesteps_1, number_of_inference_steps, api_name='/generate64')
|
383 |
|
384 |
# run blocking function in executor
|
385 |
-
|
386 |
loop = asyncio.get_running_loop()
|
387 |
result = await loop.run_in_executor(None, inference, prompt)
|
388 |
-
|
|
|
389 |
stage_1_results = result[0]
|
390 |
stage_1_result_path = result[2]
|
391 |
|
@@ -402,7 +403,7 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
402 |
await thread.edit(archived=True)
|
403 |
#posting images✅----------------------------------------------------------------
|
404 |
try:
|
405 |
-
|
406 |
png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
|
407 |
|
408 |
if png_files:
|
@@ -435,7 +436,7 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
435 |
combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
|
436 |
f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
|
437 |
|
438 |
-
|
439 |
emoji_list = ['↖️', '↗️', '↙️', '↘️']
|
440 |
await react1234(emoji_list, combined_image_dfif)
|
441 |
|
@@ -599,17 +600,19 @@ async def falcon(ctx, *, prompt: str):
|
|
599 |
if randomuuid in item[0]: # uuid should be in first item
|
600 |
text = item[1] if len(item) > 1 else '' # if there is no item[1], it won't work
|
601 |
length = len(text)
|
602 |
-
if length > max_length:
|
|
|
603 |
max_length = length
|
604 |
-
max_length_file = filepath
|
605 |
|
606 |
if max_length_file is not None:
|
607 |
print(f"The JSON file '{max_length_file}' contains the largest amount of text after the UUID.")
|
608 |
-
|
609 |
-
|
610 |
-
await ctx.reply(f"Here's the resulting json file:\n{data}")
|
611 |
else:
|
612 |
-
print("No JSON file containing the UUID was found.")
|
|
|
|
|
613 |
'''
|
614 |
result2 = falconspace.predict(
|
615 |
prompt, # str in 'Type an input and press Enter' Textbox component
|
|
|
382 |
# prompt, negative_prompt, seed, number_of_images, guidance_scale, custom_timesteps_1, number_of_inference_steps, api_name='/generate64')
|
383 |
|
384 |
# run blocking function in executor
|
385 |
+
await thread.send(f'✅running blocking function in executor')
|
386 |
loop = asyncio.get_running_loop()
|
387 |
result = await loop.run_in_executor(None, inference, prompt)
|
388 |
+
await thread.send(f'{ctx.author.mention}after executor')
|
389 |
+
await thread.send(f'✅run_in_executor ran successfully')
|
390 |
stage_1_results = result[0]
|
391 |
stage_1_result_path = result[2]
|
392 |
|
|
|
403 |
await thread.edit(archived=True)
|
404 |
#posting images✅----------------------------------------------------------------
|
405 |
try:
|
406 |
+
await thread.send(f'✅combining images...')
|
407 |
png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
|
408 |
|
409 |
if png_files:
|
|
|
436 |
combined_image_dfif = await thread.send(f'{ctx.author.mention}React with the image number you want to upscale!', file=discord.File(
|
437 |
f, f'{partialpath}{dfif_command_message_id}.png')) # named something like: tmpgtv4qjix1111269940599738479.png
|
438 |
|
439 |
+
await thread.send(f'✅reacting with 1234...')
|
440 |
emoji_list = ['↖️', '↗️', '↙️', '↘️']
|
441 |
await react1234(emoji_list, combined_image_dfif)
|
442 |
|
|
|
600 |
if randomuuid in item[0]: # uuid should be in first item
|
601 |
text = item[1] if len(item) > 1 else '' # if there is no item[1], it won't work
|
602 |
length = len(text)
|
603 |
+
if length > max_length: # can just pass the text variable to the discord bot
|
604 |
+
outputtext = text
|
605 |
max_length = length
|
606 |
+
max_length_file = filepath # may not be needed
|
607 |
|
608 |
if max_length_file is not None:
|
609 |
print(f"The JSON file '{max_length_file}' contains the largest amount of text after the UUID.")
|
610 |
+
await ctx.reply(f"{outputtext}")
|
611 |
+
await ctx.message.add_reaction('<:agree:1098629085955113011>')
|
|
|
612 |
else:
|
613 |
+
print("No JSON file containing the UUID was found.")
|
614 |
+
await ctx.message.add_reaction('<:disagree:1098628957521313892>')
|
615 |
+
|
616 |
'''
|
617 |
result2 = falconspace.predict(
|
618 |
prompt, # str in 'Type an input and press Enter' Textbox component
|