Spaces:
Runtime error
Runtime error
Update app.py
#2
by
ali-ghamdan
- opened
app.py
CHANGED
|
@@ -21,15 +21,15 @@ num_steps=50,
|
|
| 21 |
prior_cf_scale=1,
|
| 22 |
prior_steps='25',
|
| 23 |
"""
|
| 24 |
-
def infer(prompt, negative='low quality, bad quality'):
|
| 25 |
images = model.generate_text2img(prompt,
|
| 26 |
negative_prior_prompt=negative,
|
| 27 |
negative_decoder_prompt=negative,
|
| 28 |
-
num_steps=
|
| 29 |
batch_size=1,
|
| 30 |
-
guidance_scale=
|
| 31 |
-
h=
|
| 32 |
-
sampler=
|
| 33 |
prior_cf_scale=1,
|
| 34 |
prior_steps="25",)
|
| 35 |
return images
|
|
@@ -218,7 +218,12 @@ Kandinsky 2.1 was trained on a large-scale image-text dataset LAION HighRes and
|
|
| 218 |
border=(True, False, True, True),
|
| 219 |
rounded=(True, False, False, True),
|
| 220 |
container=False,
|
| 221 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
btn = gr.Button("Run").style(
|
| 223 |
margin=False,
|
| 224 |
rounded=(False, True, True, False),
|
|
@@ -228,11 +233,11 @@ Kandinsky 2.1 was trained on a large-scale image-text dataset LAION HighRes and
|
|
| 228 |
grid=[2], height="auto"
|
| 229 |
)
|
| 230 |
|
| 231 |
-
ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative], outputs=gallery, cache_examples=True)
|
| 232 |
ex.dataset.headers = [""]
|
| 233 |
|
| 234 |
-
text.submit(infer, inputs=[text, negative], outputs=gallery)
|
| 235 |
-
btn.click(infer, inputs=[text, negative], outputs=gallery)
|
| 236 |
gr.Markdown("""
|
| 237 |
|
| 238 |
|
|
|
|
| 21 |
prior_cf_scale=1,
|
| 22 |
prior_steps='25',
|
| 23 |
"""
|
| 24 |
+
def infer(prompt, negative='low quality, bad quality', w=768, h=768, sampler="ddim_sampler", steps=50, scale=4):
|
| 25 |
images = model.generate_text2img(prompt,
|
| 26 |
negative_prior_prompt=negative,
|
| 27 |
negative_decoder_prompt=negative,
|
| 28 |
+
num_steps=steps,
|
| 29 |
batch_size=1,
|
| 30 |
+
guidance_scale=scale,
|
| 31 |
+
h=h, w=w,
|
| 32 |
+
sampler=sampler,
|
| 33 |
prior_cf_scale=1,
|
| 34 |
prior_steps="25",)
|
| 35 |
return images
|
|
|
|
| 218 |
border=(True, False, True, True),
|
| 219 |
rounded=(True, False, False, True),
|
| 220 |
container=False,
|
| 221 |
+
)
|
| 222 |
+
width = gr.Number(label="image width", show_label=True, value=768)
|
| 223 |
+
height = gr.Number(label="image height", show_label=True, value=768)
|
| 224 |
+
sampler = gr.Radio(["ddim_sampler", "plms_sampler"], label="Sampler")
|
| 225 |
+
steps = gr.Number(label="steps", show_label=True, value=50)
|
| 226 |
+
scale = gr.Number(label="scale", show_label=True, value=50)
|
| 227 |
btn = gr.Button("Run").style(
|
| 228 |
margin=False,
|
| 229 |
rounded=(False, True, True, False),
|
|
|
|
| 233 |
grid=[2], height="auto"
|
| 234 |
)
|
| 235 |
|
| 236 |
+
ex = gr.Examples(examples=examples, fn=infer, inputs=[text, negative, width, height, sampler, steps, scale], outputs=gallery, cache_examples=True)
|
| 237 |
ex.dataset.headers = [""]
|
| 238 |
|
| 239 |
+
text.submit(infer, inputs=[text, negative, width, height, sampler, steps, scale], outputs=gallery)
|
| 240 |
+
btn.click(infer, inputs=[text, negative, width, height, sampler, steps, scale], outputs=gallery)
|
| 241 |
gr.Markdown("""
|
| 242 |
|
| 243 |
|