Spaces:
Running
on
Zero
Running
on
Zero
add resolution settings
Browse files
app.py
CHANGED
@@ -1625,9 +1625,9 @@ if __name__ == "__main__":
|
|
1625 |
# GRADIO MODE
|
1626 |
|
1627 |
@spaces.GPU()
|
1628 |
-
def infer(prompt, num_inference_steps, guidance_scale, progress=gr.Progress(track_tqdm=True)):
|
1629 |
set_seed(args.seed)
|
1630 |
-
width,height = list(map(int,
|
1631 |
cross_attention_kwargs = {"edit_type": "visualize",
|
1632 |
"n_self_replace": 0.4,
|
1633 |
"n_cross_replace": {"default_": 1.0, "confetti": 0.8},
|
@@ -1690,6 +1690,13 @@ if __name__ == "__main__":
|
|
1690 |
""")
|
1691 |
prompt = gr.Textbox(label="Prompt")
|
1692 |
with gr.Accordion("Advanced settings", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1693 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1694 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
1695 |
submit_btn = gr.Button("Submit")
|
@@ -1704,7 +1711,7 @@ if __name__ == "__main__":
|
|
1704 |
)
|
1705 |
submit_btn.click(
|
1706 |
fn = infer,
|
1707 |
-
inputs = [prompt, num_inference_steps, guidance_scale],
|
1708 |
outputs = [output_images],
|
1709 |
show_api=False
|
1710 |
)
|
|
|
1625 |
# GRADIO MODE
|
1626 |
|
1627 |
@spaces.GPU()
|
1628 |
+
def infer(prompt, resolution, num_inference_steps, guidance_scale, progress=gr.Progress(track_tqdm=True)):
|
1629 |
set_seed(args.seed)
|
1630 |
+
width,height = list(map(int, resolution.split(',')))
|
1631 |
cross_attention_kwargs = {"edit_type": "visualize",
|
1632 |
"n_self_replace": 0.4,
|
1633 |
"n_cross_replace": {"default_": 1.0, "confetti": 0.8},
|
|
|
1690 |
""")
|
1691 |
prompt = gr.Textbox(label="Prompt")
|
1692 |
with gr.Accordion("Advanced settings", open=False):
|
1693 |
+
resolution = gr.Radio(
|
1694 |
+
label = "Resolution",
|
1695 |
+
choices = [
|
1696 |
+
"1024,1024", "2048,2048", "2048,1024", "1536,3072", "3072,3072", "4096,4096", "4096,2048"
|
1697 |
+
],
|
1698 |
+
value = "1024,1024"
|
1699 |
+
)
|
1700 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1701 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
1702 |
submit_btn = gr.Button("Submit")
|
|
|
1711 |
)
|
1712 |
submit_btn.click(
|
1713 |
fn = infer,
|
1714 |
+
inputs = [prompt, resolution, num_inference_steps, guidance_scale],
|
1715 |
outputs = [output_images],
|
1716 |
show_api=False
|
1717 |
)
|