cocktailpeanut commited on
Commit
f1a6530
1 Parent(s): 60d647a

width/height

Browse files
Files changed (1) hide show
  1. app.py +26 -8
app.py CHANGED
@@ -51,6 +51,8 @@ def generate_image(
51
  prompt,
52
  ckpt,
53
  num_inference_steps,
 
 
54
  progress=gr.Progress(track_tqdm=True),
55
  mode="sdxl",
56
  ):
@@ -77,7 +79,7 @@ def generate_image(
77
  )
78
 
79
  results = pipe(
80
- prompt, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale
81
  )
82
 
83
  # if SAFETY_CHECKER:
@@ -104,7 +106,7 @@ css = """
104
  with gr.Blocks(css=css) as demo:
105
  gr.Markdown(
106
  """
107
- # Phased Consistency Model
108
 
109
  Phased Consistency Model (PCM) is an image generation technique that addresses the limitations of the Latent Consistency Model (LCM) in high-resolution and text-conditioned image generation.
110
  PCM outperforms LCM across various generation settings and achieves state-of-the-art results in both image and video generation.
@@ -118,16 +120,32 @@ PCM outperforms LCM across various generation settings and achieves state-of-the
118
  ckpt = gr.Dropdown(
119
  label="Select inference steps",
120
  choices=list(checkpoints.keys()),
121
- value="4-Step",
122
  )
123
  steps = gr.Slider(
124
  label="Number of Inference Steps",
125
  minimum=1,
126
  maximum=20,
127
  step=1,
128
- value=4,
129
  interactive=False,
130
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  ckpt.change(
132
  fn=update_steps,
133
  inputs=[ckpt],
@@ -169,22 +187,22 @@ PCM outperforms LCM across various generation settings and achieves state-of-the
169
  4,
170
  ],
171
  ],
172
- inputs=[prompt, ckpt, steps],
173
  outputs=[img],
174
  fn=generate_image,
175
- cache_examples="lazy",
176
  )
177
 
178
  gr.on(
179
  fn=generate_image,
180
  triggers=[ckpt.change, prompt.submit, submit_sdxl.click],
181
- inputs=[prompt, ckpt, steps],
182
  outputs=[img],
183
  )
184
  gr.on(
185
  fn=lambda *args: generate_image(*args, mode="sd15"),
186
  triggers=[submit_sd15.click],
187
- inputs=[prompt, ckpt, steps],
188
  outputs=[img],
189
  )
190
 
 
51
  prompt,
52
  ckpt,
53
  num_inference_steps,
54
+ width,
55
+ height,
56
  progress=gr.Progress(track_tqdm=True),
57
  mode="sdxl",
58
  ):
 
79
  )
80
 
81
  results = pipe(
82
+ prompt, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale, width=width, height=height
83
  )
84
 
85
  # if SAFETY_CHECKER:
 
106
  with gr.Blocks(css=css) as demo:
107
  gr.Markdown(
108
  """
109
+ # Phased Consistency Model
110
 
111
  Phased Consistency Model (PCM) is an image generation technique that addresses the limitations of the Latent Consistency Model (LCM) in high-resolution and text-conditioned image generation.
112
  PCM outperforms LCM across various generation settings and achieves state-of-the-art results in both image and video generation.
 
120
  ckpt = gr.Dropdown(
121
  label="Select inference steps",
122
  choices=list(checkpoints.keys()),
123
+ value="2-Step",
124
  )
125
  steps = gr.Slider(
126
  label="Number of Inference Steps",
127
  minimum=1,
128
  maximum=20,
129
  step=1,
130
+ value=2,
131
  interactive=False,
132
  )
133
+ width = gr.Slider(
134
+ label="Width",
135
+ minimum=512,
136
+ maximum=1024,
137
+ step=256,
138
+ value=512,
139
+ interactive=True
140
+ )
141
+ height = gr.Slider(
142
+ label="Height",
143
+ minimum=512,
144
+ maximum=1024,
145
+ step=256,
146
+ value=512,
147
+ interactive=True
148
+ )
149
  ckpt.change(
150
  fn=update_steps,
151
  inputs=[ckpt],
 
187
  4,
188
  ],
189
  ],
190
+ inputs=[prompt, ckpt, steps, width, height],
191
  outputs=[img],
192
  fn=generate_image,
193
+ #cache_examples="lazy",
194
  )
195
 
196
  gr.on(
197
  fn=generate_image,
198
  triggers=[ckpt.change, prompt.submit, submit_sdxl.click],
199
+ inputs=[prompt, ckpt, steps, width, height],
200
  outputs=[img],
201
  )
202
  gr.on(
203
  fn=lambda *args: generate_image(*args, mode="sd15"),
204
  triggers=[submit_sd15.click],
205
+ inputs=[prompt, ckpt, steps, width, height],
206
  outputs=[img],
207
  )
208