PeterL1n commited on
Commit
0ce0e61
1 Parent(s): 7e06c4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -17
app.py CHANGED
@@ -16,7 +16,7 @@ opts = {
16
  }
17
 
18
  step_loaded = 4
19
- unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", 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,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.Group():
40
- with gr.Row():
41
- prompt = gr.Textbox(
42
- label="Text prompt",
43
- scale=8
44
- )
45
- option = gr.Dropdown(
46
- label="Inference steps",
47
- choices=["1 Step", "2 Steps", "4 Steps", "8 Steps"],
48
- value="4 Steps",
49
- interactive=True
50
- )
51
- submit = gr.Button(
52
- scale=1,
53
- variant="primary"
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