Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1625,14 +1625,14 @@ if __name__ == "__main__":
|
|
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(
|
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},
|
1634 |
}
|
1635 |
-
seed =
|
1636 |
generator = torch.Generator(device='cuda')
|
1637 |
generator = generator.manual_seed(seed)
|
1638 |
|
@@ -1672,6 +1672,9 @@ if __name__ == "__main__":
|
|
1672 |
margin: 0 auto;
|
1673 |
}
|
1674 |
"""
|
|
|
|
|
|
|
1675 |
with gr.Blocks(css=css) as demo:
|
1676 |
with gr.Column(elem_id="col-container"):
|
1677 |
gr.Markdown("# AccDiffusion: An Accurate Method for Higher-Resolution Image Generation")
|
@@ -1704,6 +1707,7 @@ if __name__ == "__main__":
|
|
1704 |
with gr.Column():
|
1705 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1706 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
|
|
1707 |
|
1708 |
output_images = gr.Image(label="Output Image", format="png")
|
1709 |
gr.Examples(
|
@@ -1716,7 +1720,7 @@ if __name__ == "__main__":
|
|
1716 |
)
|
1717 |
submit_btn.click(
|
1718 |
fn = infer,
|
1719 |
-
inputs = [prompt, resolution, num_inference_steps, guidance_scale],
|
1720 |
outputs = [output_images],
|
1721 |
show_api=False
|
1722 |
)
|
|
|
1625 |
# GRADIO MODE
|
1626 |
|
1627 |
@spaces.GPU()
|
1628 |
+
def infer(prompt, resolution, num_inference_steps, guidance_scale, seed, progress=gr.Progress(track_tqdm=True)):
|
1629 |
+
set_seed(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},
|
1634 |
}
|
1635 |
+
seed = seed
|
1636 |
generator = torch.Generator(device='cuda')
|
1637 |
generator = generator.manual_seed(seed)
|
1638 |
|
|
|
1672 |
margin: 0 auto;
|
1673 |
}
|
1674 |
"""
|
1675 |
+
|
1676 |
+
MAX_SEED = np.iinfo(np.int32).max
|
1677 |
+
|
1678 |
with gr.Blocks(css=css) as demo:
|
1679 |
with gr.Column(elem_id="col-container"):
|
1680 |
gr.Markdown("# AccDiffusion: An Accurate Method for Higher-Resolution Image Generation")
|
|
|
1707 |
with gr.Column():
|
1708 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1709 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
1710 |
+
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42)
|
1711 |
|
1712 |
output_images = gr.Image(label="Output Image", format="png")
|
1713 |
gr.Examples(
|
|
|
1720 |
)
|
1721 |
submit_btn.click(
|
1722 |
fn = infer,
|
1723 |
+
inputs = [prompt, resolution, num_inference_steps, guidance_scale, seed],
|
1724 |
outputs = [output_images],
|
1725 |
show_api=False
|
1726 |
)
|