Spaces:
Running
on
A100
Running
on
A100
Commit
•
80e4491
1
Parent(s):
e1232bd
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ if TORCH_COMPILE:
|
|
60 |
pipe.load_lora_weights(
|
61 |
"lcm-sd/lcm-sdxl-lora",
|
62 |
weight_name="lcm_sdxl_lora.safetensors",
|
63 |
-
adapter_name="lcm",
|
64 |
use_auth_token=HF_TOKEN,
|
65 |
)
|
66 |
|
@@ -123,7 +123,8 @@ css = """
|
|
123 |
with gr.Blocks(css=css) as demo:
|
124 |
with gr.Column(elem_id="container"):
|
125 |
gr.Markdown(
|
126 |
-
"""# Ultra-Fast SDXL
|
|
|
127 |
""",
|
128 |
elem_id="intro",
|
129 |
)
|
@@ -133,6 +134,8 @@ with gr.Blocks(css=css) as demo:
|
|
133 |
placeholder="Insert your prompt here:", value="papercut style of a cute monster", scale=5, container=False
|
134 |
)
|
135 |
generate_bt = gr.Button("Generate", scale=1)
|
|
|
|
|
136 |
with gr.Accordion("Advanced options", open=False):
|
137 |
guidance = gr.Slider(
|
138 |
label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
|
@@ -141,8 +144,23 @@ with gr.Blocks(css=css) as demo:
|
|
141 |
seed = gr.Slider(
|
142 |
randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
|
143 |
)
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
inputs = [prompt, guidance, steps, seed]
|
147 |
generate_bt.click(fn=predict, inputs=inputs, outputs=image)
|
148 |
|
|
|
60 |
pipe.load_lora_weights(
|
61 |
"lcm-sd/lcm-sdxl-lora",
|
62 |
weight_name="lcm_sdxl_lora.safetensors",
|
63 |
+
#adapter_name="lcm",
|
64 |
use_auth_token=HF_TOKEN,
|
65 |
)
|
66 |
|
|
|
123 |
with gr.Blocks(css=css) as demo:
|
124 |
with gr.Column(elem_id="container"):
|
125 |
gr.Markdown(
|
126 |
+
"""# Ultra-Fast SDXL with Latent Consistency LoRA
|
127 |
+
In this Space, SDXL is loaded with a latent consistency LoRA, giving it the super power of doing inference in as little as 4 steps. [Learn more on our blog](#) or [technical report](#).
|
128 |
""",
|
129 |
elem_id="intro",
|
130 |
)
|
|
|
134 |
placeholder="Insert your prompt here:", value="papercut style of a cute monster", scale=5, container=False
|
135 |
)
|
136 |
generate_bt = gr.Button("Generate", scale=1)
|
137 |
+
|
138 |
+
image = gr.Image(type="filepath")
|
139 |
with gr.Accordion("Advanced options", open=False):
|
140 |
guidance = gr.Slider(
|
141 |
label="Guidance", minimum=0.0, maximum=5, value=0.3, step=0.001
|
|
|
144 |
seed = gr.Slider(
|
145 |
randomize=True, minimum=0, maximum=12013012031030, label="Seed", step=1
|
146 |
)
|
147 |
+
with gr.Group():
|
148 |
+
gr.Markdown('''## Using it with `diffusers`
|
149 |
+
```py
|
150 |
+
from diffusers import DiffusionPipeline, LCMScheduler
|
151 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0").to("cuda")
|
152 |
+
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
153 |
+
pipe.load_lora_weights("lcm-sd/lcm-sdxl-lora")
|
154 |
+
|
155 |
+
results = pipe(
|
156 |
+
prompt="The spirit of a tamagotchi wandering in the city of Vienna",
|
157 |
+
num_inference_steps=4,
|
158 |
+
guidance_scale=0.5,
|
159 |
+
)
|
160 |
+
results.images[0]
|
161 |
+
```
|
162 |
+
''')
|
163 |
+
|
164 |
inputs = [prompt, guidance, steps, seed]
|
165 |
generate_bt.click(fn=predict, inputs=inputs, outputs=image)
|
166 |
|