Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ opts = {
|
|
16 |
}
|
17 |
|
18 |
step_loaded = 4
|
19 |
-
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to(
|
20 |
unet.load_state_dict(load_file(hf_hub_download(repo, opts["4 Steps"][0]), device=device))
|
21 |
pipe = StableDiffusionXLPipeline.from_pretrained(base, torch_dtype=torch.float16, variant="fp16").to(device)
|
22 |
|
@@ -36,22 +36,21 @@ with gr.Blocks() as demo:
|
|
36 |
"<p><center><a href='https://huggingface.co/ByteDance/SDXL-Lightning'>https://huggingface.co/ByteDance/SDXL-Lightning</a></center></p>"
|
37 |
)
|
38 |
|
39 |
-
with gr.
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
)
|
55 |
|
56 |
img = gr.Image(label="SDXL-Lightening Generated Image")
|
57 |
|
|
|
16 |
}
|
17 |
|
18 |
step_loaded = 4
|
19 |
+
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to(device, torch.float16)
|
20 |
unet.load_state_dict(load_file(hf_hub_download(repo, opts["4 Steps"][0]), device=device))
|
21 |
pipe = StableDiffusionXLPipeline.from_pretrained(base, torch_dtype=torch.float16, variant="fp16").to(device)
|
22 |
|
|
|
36 |
"<p><center><a href='https://huggingface.co/ByteDance/SDXL-Lightning'>https://huggingface.co/ByteDance/SDXL-Lightning</a></center></p>"
|
37 |
)
|
38 |
|
39 |
+
with gr.Row():
|
40 |
+
prompt = gr.Textbox(
|
41 |
+
label="Text prompt",
|
42 |
+
scale=8
|
43 |
+
)
|
44 |
+
option = gr.Dropdown(
|
45 |
+
label="Inference steps",
|
46 |
+
choices=["1 Step", "2 Steps", "4 Steps", "8 Steps"],
|
47 |
+
value="4 Steps",
|
48 |
+
interactive=True
|
49 |
+
)
|
50 |
+
submit = gr.Button(
|
51 |
+
scale=1,
|
52 |
+
variant="primary"
|
53 |
+
)
|
|
|
54 |
|
55 |
img = gr.Image(label="SDXL-Lightening Generated Image")
|
56 |
|