Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,10 +23,15 @@ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev",
|
|
| 23 |
#pipe.enable_lora()
|
| 24 |
pipe.to(DEVICE)
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
def reset_do_inversion():
|
| 31 |
return True
|
| 32 |
|
|
@@ -37,11 +42,14 @@ def resize_img(image, max_size=1024):
|
|
| 37 |
new_height = int(height * scaling_factor)
|
| 38 |
return image.resize((new_width, new_height), Image.LANCZOS)
|
| 39 |
|
| 40 |
-
def check_style(stylezation):
|
| 41 |
if stylezation:
|
| 42 |
-
return
|
| 43 |
else:
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
def check_hyper_flux_lora(enable_hyper_flux):
|
| 47 |
if enable_hyper_flux:
|
|
@@ -50,7 +58,7 @@ def check_hyper_flux_lora(enable_hyper_flux):
|
|
| 50 |
return 8, 8, 4
|
| 51 |
else:
|
| 52 |
pipe.unfuse_lora()
|
| 53 |
-
return 28, 28,
|
| 54 |
|
| 55 |
@spaces.GPU(duration=85)
|
| 56 |
def invert_and_edit(image,
|
|
@@ -257,10 +265,10 @@ based on the implementations of [@raven38](https://github.com/raven38) & [@DarkM
|
|
| 257 |
)
|
| 258 |
|
| 259 |
gr.Examples(
|
| 260 |
-
examples=
|
| 261 |
-
inputs=[input_image, prompt,eta,gamma,start_timestep, stop_timestep, num_inversion_steps, num_inference_steps, seed, randomize_seed, eta_decay, decay_power, enable_hyper_flux ]
|
| 262 |
-
outputs=[result
|
| 263 |
-
|
| 264 |
)
|
| 265 |
|
| 266 |
input_image.change(
|
|
|
|
| 23 |
#pipe.enable_lora()
|
| 24 |
pipe.to(DEVICE)
|
| 25 |
|
| 26 |
+
def get_examples():
|
| 27 |
+
examples = [[Image.open("metal.png"), "a dragon, in 3d melting gold metal",0.9, 0.5, 0, 5, 28, 28, 0, False,False, 2, False,Image.open("dragon.png") ],
|
| 28 |
+
[Image.open("doll.png"), "anime illustration",0.9, 0.5, 0, 6, 28, 28, 0, False, False, 2, False ,Image.open("anime.png")],
|
| 29 |
+
[Image.open("doll.png"), "raccoon, made of yarn",0.9, 0.5, 0, 4, 28, 28, 0, False, False, 2, False , Image.open("raccoon.png")],
|
| 30 |
+
[Image.open("cat.jpg"), "a parrot", 0.9 ,0.5,2, 8,28, 28,0, False , False, 1, False,Image.open("parrot.png")],
|
| 31 |
+
[Image.open("cat.jpg"), "a tiger", 0.9 ,0.5,0, 4,8, 8,789385745, False , False, 1, True,Image.open("tiger.png")],
|
| 32 |
+
[Image.open("metal.png"),"a dragon, in 3d melting gold metal",0.9, 0.5, 0, 4, 8, 8, 789385745, False,True, 2, True , Image.open("dragon.png")],
|
| 33 |
+
]
|
| 34 |
+
return examples
|
| 35 |
def reset_do_inversion():
|
| 36 |
return True
|
| 37 |
|
|
|
|
| 42 |
new_height = int(height * scaling_factor)
|
| 43 |
return image.resize((new_width, new_height), Image.LANCZOS)
|
| 44 |
|
| 45 |
+
def check_style(stylezation, enable_hyper_flux):
|
| 46 |
if stylezation:
|
| 47 |
+
return 0.9, 0.5, 0, 6, 28, 28, False,False
|
| 48 |
else:
|
| 49 |
+
if enable_hyper_flux:
|
| 50 |
+
return 0.9, 0.5, 0, 4, 8, 8, False,False
|
| 51 |
+
else:
|
| 52 |
+
return 0.9, 0.5, 2, 7, 28, 28, False,False
|
| 53 |
|
| 54 |
def check_hyper_flux_lora(enable_hyper_flux):
|
| 55 |
if enable_hyper_flux:
|
|
|
|
| 58 |
return 8, 8, 4
|
| 59 |
else:
|
| 60 |
pipe.unfuse_lora()
|
| 61 |
+
return 28, 28, 6
|
| 62 |
|
| 63 |
@spaces.GPU(duration=85)
|
| 64 |
def invert_and_edit(image,
|
|
|
|
| 265 |
)
|
| 266 |
|
| 267 |
gr.Examples(
|
| 268 |
+
examples=get_examples,
|
| 269 |
+
inputs=[input_image, prompt,eta,gamma,start_timestep, stop_timestep, num_inversion_steps, num_inference_steps, seed, randomize_seed, eta_decay, decay_power, enable_hyper_flux ]
|
| 270 |
+
outputs=[result],
|
| 271 |
+
|
| 272 |
)
|
| 273 |
|
| 274 |
input_image.change(
|