[decorators] cleaning up some stuff in generation part
Browse files
app.py
CHANGED
@@ -44,21 +44,21 @@ async def on_ready():
|
|
44 |
async def deepfloydif(ctx, *, prompt: str):
|
45 |
try:
|
46 |
try:
|
47 |
-
prompt = prompt.strip()[:100] # Limit the prompt length to 100 characters
|
48 |
-
prompt = re.sub(r'[^\w\s]', '', prompt) # Remove special characters
|
49 |
-
|
50 |
def check_reaction(reaction, user):
|
51 |
return user == ctx.author and str(reaction.emoji) in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']
|
52 |
|
53 |
await ctx.message.add_reaction('👍')
|
54 |
thread = await ctx.message.create_thread(name=f'{ctx.author} Image Upscaling Thread ')
|
55 |
# create thread -> send new message inside thread + combined_image -> add reactions -> dfif2
|
56 |
-
|
57 |
-
|
|
|
|
|
58 |
number_of_images = 4
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
62 |
except Exception as e:
|
63 |
print(f"Error: {e}")
|
64 |
await ctx.reply('stage 1 error -> pre generation')
|
@@ -66,7 +66,8 @@ async def deepfloydif(ctx, *, prompt: str):
|
|
66 |
|
67 |
|
68 |
try:
|
69 |
-
stage_1_results, stage_1_param_path, stage_1_result_path =
|
|
|
70 |
png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
|
71 |
except Exception as e:
|
72 |
print(f"Error: {e}")
|
|
|
44 |
async def deepfloydif(ctx, *, prompt: str):
|
45 |
try:
|
46 |
try:
|
|
|
|
|
|
|
47 |
def check_reaction(reaction, user):
|
48 |
return user == ctx.author and str(reaction.emoji) in ['1️⃣', '2️⃣', '3️⃣', '4️⃣']
|
49 |
|
50 |
await ctx.message.add_reaction('👍')
|
51 |
thread = await ctx.message.create_thread(name=f'{ctx.author} Image Upscaling Thread ')
|
52 |
# create thread -> send new message inside thread + combined_image -> add reactions -> dfif2
|
53 |
+
|
54 |
+
|
55 |
+
negative_prompt = ''
|
56 |
+
seed = 0 # testing no random
|
57 |
number_of_images = 4
|
58 |
+
guidance_scale = 7
|
59 |
+
custom_timesteps_1 = 'smart50'
|
60 |
+
number_of_inference_steps = 50
|
61 |
+
|
62 |
except Exception as e:
|
63 |
print(f"Error: {e}")
|
64 |
await ctx.reply('stage 1 error -> pre generation')
|
|
|
66 |
|
67 |
|
68 |
try:
|
69 |
+
stage_1_results, stage_1_param_path, stage_1_result_path =
|
70 |
+
df.predict(prompt, negative_prompt, seed, number_of_images, guidance_scale, custom_timesteps_1, number_of_inference_steps, api_name='/generate64')
|
71 |
png_files = [f for f in os.listdir(stage_1_results) if f.endswith('.png')]
|
72 |
except Exception as e:
|
73 |
print(f"Error: {e}")
|