Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -59,13 +59,16 @@ def scrape_lora_link(url):
|
|
59 |
return None
|
60 |
|
61 |
def enable_lora(lora_scale, lora_in, lora_add):
|
62 |
-
if
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
69 |
|
70 |
@spaces.GPU()
|
71 |
def generate_image(
|
@@ -207,7 +210,7 @@ with gr.Blocks(css=CSS, js=JS, theme="Nymbo/Nymbo_Theme") as demo:
|
|
207 |
value=1.0,
|
208 |
)
|
209 |
lora_in = gr.Dropdown(
|
210 |
-
|
211 |
label="LoRA Model",
|
212 |
info="Load the LoRA",
|
213 |
value="Shakker-Labs/FLUX.1-dev-LoRA-blended-realistic-illustration",
|
|
|
59 |
return None
|
60 |
|
61 |
def enable_lora(lora_scale, lora_in, lora_add):
|
62 |
+
if not lora_in and not lora_add:
|
63 |
+
return
|
64 |
+
else:
|
65 |
+
if load_in:
|
66 |
+
lora_add = load_in
|
67 |
+
url = f'https://huggingface.co/{lora_add}/tree/main'
|
68 |
+
lora_name = scrape_lora_link(url)
|
69 |
+
pipe.load_lora_weights(lora_add, weight_name=lora_name)
|
70 |
+
pipe.fuse_lora(lora_scale=lora_scale)
|
71 |
+
pipe.to(device="cuda", dtype=torch.bfloat16)
|
72 |
|
73 |
@spaces.GPU()
|
74 |
def generate_image(
|
|
|
210 |
value=1.0,
|
211 |
)
|
212 |
lora_in = gr.Dropdown(
|
213 |
+
choices=["Shakker-Labs/FLUX.1-dev-LoRA-blended-realistic-illustration", "Shakker-Labs/AWPortrait-FL", ""],
|
214 |
label="LoRA Model",
|
215 |
info="Load the LoRA",
|
216 |
value="Shakker-Labs/FLUX.1-dev-LoRA-blended-realistic-illustration",
|