Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -372,7 +372,10 @@ def infer(
|
|
| 372 |
"""Main inference function with Lightning always active"""
|
| 373 |
if not lora_name:
|
| 374 |
raise gr.Error("Please select a LoRA model.")
|
| 375 |
-
|
|
|
|
|
|
|
|
|
|
| 376 |
config = LORA_CONFIG[lora_name]
|
| 377 |
|
| 378 |
if config["type"] == "style":
|
|
@@ -408,8 +411,9 @@ def infer(
|
|
| 408 |
negative_prompt=" ",
|
| 409 |
num_inference_steps=int(num_inference_steps),
|
| 410 |
generator=generator,
|
|
|
|
| 411 |
true_cfg_scale=true_guidance_scale,
|
| 412 |
-
).images
|
| 413 |
|
| 414 |
# Don't unfuse Lightning - keep it active for next inference
|
| 415 |
if lora_name != LIGHTNING_LORA_NAME:
|
|
@@ -463,7 +467,7 @@ with gr.Blocks(css="#col-container { margin: 0 auto; max-width: 1024px; }") as d
|
|
| 463 |
run_button = gr.Button("Generate!", variant="primary")
|
| 464 |
|
| 465 |
with gr.Column(scale=1):
|
| 466 |
-
result_image = gr.
|
| 467 |
used_seed = gr.Number(label="Used Seed", interactive=False)
|
| 468 |
|
| 469 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
| 372 |
"""Main inference function with Lightning always active"""
|
| 373 |
if not lora_name:
|
| 374 |
raise gr.Error("Please select a LoRA model.")
|
| 375 |
+
expected_key = os.environ.get("hf_key")
|
| 376 |
+
if expected_key not in prompt:
|
| 377 |
+
print("❌ Invalid key.")
|
| 378 |
+
return None
|
| 379 |
config = LORA_CONFIG[lora_name]
|
| 380 |
|
| 381 |
if config["type"] == "style":
|
|
|
|
| 411 |
negative_prompt=" ",
|
| 412 |
num_inference_steps=int(num_inference_steps),
|
| 413 |
generator=generator,
|
| 414 |
+
num_images_per_prompt = 4,
|
| 415 |
true_cfg_scale=true_guidance_scale,
|
| 416 |
+
).images
|
| 417 |
|
| 418 |
# Don't unfuse Lightning - keep it active for next inference
|
| 419 |
if lora_name != LIGHTNING_LORA_NAME:
|
|
|
|
| 467 |
run_button = gr.Button("Generate!", variant="primary")
|
| 468 |
|
| 469 |
with gr.Column(scale=1):
|
| 470 |
+
result_image = gr.Gallery(label="", show_label=False, type="pil")
|
| 471 |
used_seed = gr.Number(label="Used Seed", interactive=False)
|
| 472 |
|
| 473 |
with gr.Accordion("Advanced Settings", open=False):
|