Spaces:
Running
on
Zero
Running
on
Zero
Upload folder using huggingface_hub
Browse files- app.py +5 -0
- modules/user/pipeline.py +13 -1
app.py
CHANGED
@@ -57,6 +57,7 @@ def generate_images(
|
|
57 |
reuse_seed: bool = False,
|
58 |
flux_enabled: bool = False,
|
59 |
prio_speed: bool = False,
|
|
|
60 |
progress=gr.Progress(),
|
61 |
):
|
62 |
"""Generate images using the LightDiffusion pipeline"""
|
@@ -84,6 +85,8 @@ def generate_images(
|
|
84 |
reuse_seed=reuse_seed,
|
85 |
flux_enabled=flux_enabled,
|
86 |
prio_speed=prio_speed,
|
|
|
|
|
87 |
)
|
88 |
|
89 |
# Clean up temporary file if it exists
|
@@ -141,6 +144,7 @@ with gr.Blocks(title="LightDiffusion Web UI") as demo:
|
|
141 |
reuse_seed = gr.Checkbox(label="Reuse Seed")
|
142 |
flux_enabled = gr.Checkbox(label="Flux Mode")
|
143 |
prio_speed = gr.Checkbox(label="Prioritize Speed")
|
|
|
144 |
|
145 |
with gr.Row():
|
146 |
img2img_enabled = gr.Checkbox(label="Image to Image Mode")
|
@@ -184,6 +188,7 @@ with gr.Blocks(title="LightDiffusion Web UI") as demo:
|
|
184 |
reuse_seed,
|
185 |
flux_enabled,
|
186 |
prio_speed,
|
|
|
187 |
],
|
188 |
outputs=gallery,
|
189 |
)
|
|
|
57 |
reuse_seed: bool = False,
|
58 |
flux_enabled: bool = False,
|
59 |
prio_speed: bool = False,
|
60 |
+
realistic_model: bool = False,
|
61 |
progress=gr.Progress(),
|
62 |
):
|
63 |
"""Generate images using the LightDiffusion pipeline"""
|
|
|
85 |
reuse_seed=reuse_seed,
|
86 |
flux_enabled=flux_enabled,
|
87 |
prio_speed=prio_speed,
|
88 |
+
autohdr=True,
|
89 |
+
realistic_model=realistic_model,
|
90 |
)
|
91 |
|
92 |
# Clean up temporary file if it exists
|
|
|
144 |
reuse_seed = gr.Checkbox(label="Reuse Seed")
|
145 |
flux_enabled = gr.Checkbox(label="Flux Mode")
|
146 |
prio_speed = gr.Checkbox(label="Prioritize Speed")
|
147 |
+
realistic_model = gr.Checkbox(label="Realistic Model")
|
148 |
|
149 |
with gr.Row():
|
150 |
img2img_enabled = gr.Checkbox(label="Image to Image Mode")
|
|
|
188 |
reuse_seed,
|
189 |
flux_enabled,
|
190 |
prio_speed,
|
191 |
+
realistic_model,
|
192 |
],
|
193 |
outputs=gallery,
|
194 |
)
|
modules/user/pipeline.py
CHANGED
@@ -43,6 +43,7 @@ def pipeline(
|
|
43 |
flux_enabled: bool = False,
|
44 |
prio_speed: bool = False,
|
45 |
autohdr: bool = False,
|
|
|
46 |
) -> None:
|
47 |
"""#### Run the LightDiffusion pipeline.
|
48 |
|
@@ -59,6 +60,7 @@ def pipeline(
|
|
59 |
- `flux_enabled` (bool, optional): Enable the flux mode. Defaults to False.
|
60 |
- `prio_speed` (bool, optional): Prioritize speed over quality. Defaults to False.
|
61 |
- `autohdr` (bool, optional): Enable the AutoHDR mode. Defaults to False.
|
|
|
62 |
"""
|
63 |
global last_seed
|
64 |
if reuse_seed:
|
@@ -76,7 +78,11 @@ def pipeline(
|
|
76 |
pass
|
77 |
|
78 |
sampler_name = "dpmpp_sde_cfgpp" if not prio_speed else "dpmpp_2m_cfgpp"
|
79 |
-
ckpt =
|
|
|
|
|
|
|
|
|
80 |
with torch.inference_mode():
|
81 |
if not flux_enabled:
|
82 |
checkpointloadersimple = Loader.CheckpointLoaderSimple()
|
@@ -526,6 +532,11 @@ if __name__ == "__main__":
|
|
526 |
action="store_true",
|
527 |
help="Enable the AutoHDR mode.",
|
528 |
)
|
|
|
|
|
|
|
|
|
|
|
529 |
args = parser.parse_args()
|
530 |
|
531 |
pipeline(
|
@@ -543,4 +554,5 @@ if __name__ == "__main__":
|
|
543 |
args.flux,
|
544 |
args.prio_speed,
|
545 |
args.autohdr,
|
|
|
546 |
)
|
|
|
43 |
flux_enabled: bool = False,
|
44 |
prio_speed: bool = False,
|
45 |
autohdr: bool = False,
|
46 |
+
realistic_model: bool = False,
|
47 |
) -> None:
|
48 |
"""#### Run the LightDiffusion pipeline.
|
49 |
|
|
|
60 |
- `flux_enabled` (bool, optional): Enable the flux mode. Defaults to False.
|
61 |
- `prio_speed` (bool, optional): Prioritize speed over quality. Defaults to False.
|
62 |
- `autohdr` (bool, optional): Enable the AutoHDR mode. Defaults to False.
|
63 |
+
- `realistic_model` (bool, optional): Use the realistic model. Defaults to False.
|
64 |
"""
|
65 |
global last_seed
|
66 |
if reuse_seed:
|
|
|
78 |
pass
|
79 |
|
80 |
sampler_name = "dpmpp_sde_cfgpp" if not prio_speed else "dpmpp_2m_cfgpp"
|
81 |
+
ckpt = (
|
82 |
+
"./_internal/checkpoints/Meina V10 - baked VAE.safetensors"
|
83 |
+
if not realistic_model
|
84 |
+
else "./_internal/checkpoints/DreamShaper_8_pruned.safetensors"
|
85 |
+
)
|
86 |
with torch.inference_mode():
|
87 |
if not flux_enabled:
|
88 |
checkpointloadersimple = Loader.CheckpointLoaderSimple()
|
|
|
532 |
action="store_true",
|
533 |
help="Enable the AutoHDR mode.",
|
534 |
)
|
535 |
+
parser.add_argument(
|
536 |
+
"--realistic-model",
|
537 |
+
action="store_true",
|
538 |
+
help="Use the realistic model.",
|
539 |
+
)
|
540 |
args = parser.parse_args()
|
541 |
|
542 |
pipeline(
|
|
|
554 |
args.flux,
|
555 |
args.prio_speed,
|
556 |
args.autohdr,
|
557 |
+
args.realistic_model,
|
558 |
)
|