Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1626,8 +1626,8 @@ if __name__ == "__main__":
|
|
1626 |
|
1627 |
# GRADIO MODE
|
1628 |
|
1629 |
-
@spaces.GPU(duration=
|
1630 |
-
def infer(prompt, resolution, num_inference_steps, guidance_scale, seed, use_progressive_upscaling, progress=gr.Progress(track_tqdm=True)):
|
1631 |
set_seed(seed)
|
1632 |
width,height = list(map(int, resolution.split(',')))
|
1633 |
cross_attention_kwargs = {"edit_type": "visualize",
|
@@ -1659,13 +1659,13 @@ if __name__ == "__main__":
|
|
1659 |
sigma=args.sigma, use_guassian=args.use_guassian,
|
1660 |
multi_decoder=args.multi_decoder,
|
1661 |
upscale_mode=args.upscale_mode,
|
1662 |
-
use_multidiffusion=
|
1663 |
-
use_skip_residual=
|
1664 |
use_progressive_upscaling=use_progressive_upscaling,
|
1665 |
-
use_dilated_sampling=
|
1666 |
-
shuffle=
|
1667 |
result_path=result_path,
|
1668 |
-
debug=args.debug, save_attention_map=args.save_attention_map, use_md_prompt=
|
1669 |
)
|
1670 |
print(images)
|
1671 |
|
@@ -1720,13 +1720,19 @@ if __name__ == "__main__":
|
|
1720 |
choices = [
|
1721 |
"1024,1024", "2048,2048", "2048,1024", "1536,3072", "3072,3072", "4096,4096", "4096,2048"
|
1722 |
],
|
1723 |
-
value = "
|
|
|
1724 |
)
|
1725 |
with gr.Column():
|
1726 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1727 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
1728 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42)
|
|
|
|
|
|
|
1729 |
use_progressive_upscaling = gr.Checkbox(label="use_progressive_upscaling", value=False)
|
|
|
|
|
1730 |
|
1731 |
output_images = gr.Gallery(label="Output Image", format="png")
|
1732 |
gr.Examples(
|
@@ -1739,7 +1745,8 @@ if __name__ == "__main__":
|
|
1739 |
)
|
1740 |
submit_btn.click(
|
1741 |
fn = infer,
|
1742 |
-
inputs = [prompt, resolution, num_inference_steps, guidance_scale, seed,
|
|
|
1743 |
outputs = [output_images],
|
1744 |
show_api=False
|
1745 |
)
|
|
|
1626 |
|
1627 |
# GRADIO MODE
|
1628 |
|
1629 |
+
@spaces.GPU(duration=200)
|
1630 |
+
def infer(prompt, resolution, num_inference_steps, guidance_scale, seed, use_multidiffusion, use_skip_residual, use_dilated_sampling, use_progressive_upscaling, shuffle, use_md_prompt, progress=gr.Progress(track_tqdm=True)):
|
1631 |
set_seed(seed)
|
1632 |
width,height = list(map(int, resolution.split(',')))
|
1633 |
cross_attention_kwargs = {"edit_type": "visualize",
|
|
|
1659 |
sigma=args.sigma, use_guassian=args.use_guassian,
|
1660 |
multi_decoder=args.multi_decoder,
|
1661 |
upscale_mode=args.upscale_mode,
|
1662 |
+
use_multidiffusion=use_multidiffusion,
|
1663 |
+
use_skip_residual=use_skip_residual,
|
1664 |
use_progressive_upscaling=use_progressive_upscaling,
|
1665 |
+
use_dilated_sampling=use_dilated_sampling,
|
1666 |
+
shuffle=shuffle,
|
1667 |
result_path=result_path,
|
1668 |
+
debug=args.debug, save_attention_map=args.save_attention_map, use_md_prompt=use_md_prompt, c=args.c
|
1669 |
)
|
1670 |
print(images)
|
1671 |
|
|
|
1720 |
choices = [
|
1721 |
"1024,1024", "2048,2048", "2048,1024", "1536,3072", "3072,3072", "4096,4096", "4096,2048"
|
1722 |
],
|
1723 |
+
value = "2048,2048",
|
1724 |
+
interactive=False
|
1725 |
)
|
1726 |
with gr.Column():
|
1727 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=2, maximum=50, step=1, value=50)
|
1728 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=510, step=0.1, value=7.5)
|
1729 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42)
|
1730 |
+
use_multidiffusion = gr.Checkbox(label="use_multidiffusion", value=True)
|
1731 |
+
use_skip_residual = gr.Checkbox(label="use_skip_residual", value=True)
|
1732 |
+
use_dilated_sampling = gr.Checkbox(label="use_dilated_sampling", value=True)
|
1733 |
use_progressive_upscaling = gr.Checkbox(label="use_progressive_upscaling", value=False)
|
1734 |
+
shuffle = gr.Checkbox(label="shuffle", value=False)
|
1735 |
+
use_md_prompt = gr.Checkbox(label="use_md_prompt", value=False)
|
1736 |
|
1737 |
output_images = gr.Gallery(label="Output Image", format="png")
|
1738 |
gr.Examples(
|
|
|
1745 |
)
|
1746 |
submit_btn.click(
|
1747 |
fn = infer,
|
1748 |
+
inputs = [prompt, resolution, num_inference_steps, guidance_scale, seed,
|
1749 |
+
use_multidiffusion, use_skip_residual, use_dilated_sampling, use_progressive_upscaling, shuffle, use_md_prompt],
|
1750 |
outputs = [output_images],
|
1751 |
show_api=False
|
1752 |
)
|