Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ else:
|
|
| 108 |
print("Initialization complete. Gradio is starting...")
|
| 109 |
|
| 110 |
@spaces.GPU(duration = 45)
|
| 111 |
-
def generate(prompt, negative_prompt, width, height, num_inference_steps, optional_lora_id, progress=gr.Progress(track_tqdm=True)):
|
| 112 |
|
| 113 |
# --- Step 1: ALWAYS build the full weight vector from scratch for THIS run ---
|
| 114 |
|
|
@@ -126,7 +126,7 @@ def generate(prompt, negative_prompt, width, height, num_inference_steps, option
|
|
| 126 |
if internal_name_to_add:
|
| 127 |
try:
|
| 128 |
optional_lora_index = ALL_ADAPTER_NAMES.index(internal_name_to_add)
|
| 129 |
-
adapter_weights[optional_lora_index] =
|
| 130 |
except ValueError:
|
| 131 |
print(f"Warning: Could not find index for selected LoRA '{internal_name_to_add}'. It will not be applied.")
|
| 132 |
|
|
@@ -165,7 +165,8 @@ iface = gr.Interface(
|
|
| 165 |
gr.Slider(minimum=1, maximum=80, step=1, label="Inference Steps", value=10),
|
| 166 |
gr.Textbox(
|
| 167 |
label="Optional LoRA",
|
| 168 |
-
)
|
|
|
|
| 169 |
],
|
| 170 |
outputs=gr.Image(label="output"),
|
| 171 |
)
|
|
|
|
| 108 |
print("Initialization complete. Gradio is starting...")
|
| 109 |
|
| 110 |
@spaces.GPU(duration = 45)
|
| 111 |
+
def generate(prompt, negative_prompt, width, height, num_inference_steps, optional_lora_id, lora_weights, progress=gr.Progress(track_tqdm=True)):
|
| 112 |
|
| 113 |
# --- Step 1: ALWAYS build the full weight vector from scratch for THIS run ---
|
| 114 |
|
|
|
|
| 126 |
if internal_name_to_add:
|
| 127 |
try:
|
| 128 |
optional_lora_index = ALL_ADAPTER_NAMES.index(internal_name_to_add)
|
| 129 |
+
adapter_weights[optional_lora_index] = lora_weights
|
| 130 |
except ValueError:
|
| 131 |
print(f"Warning: Could not find index for selected LoRA '{internal_name_to_add}'. It will not be applied.")
|
| 132 |
|
|
|
|
| 165 |
gr.Slider(minimum=1, maximum=80, step=1, label="Inference Steps", value=10),
|
| 166 |
gr.Textbox(
|
| 167 |
label="Optional LoRA",
|
| 168 |
+
),
|
| 169 |
+
gr.Slider(label="LoRA Weights", minimum=0, maximum=2, step=0.01, value=1)
|
| 170 |
],
|
| 171 |
outputs=gr.Image(label="output"),
|
| 172 |
)
|