fffiloni commited on
Commit
3649171
1 Parent(s): 44a062c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -1619,7 +1619,7 @@ if __name__ == "__main__":
1619
 
1620
  # GRADIO MODE
1621
 
1622
- def infer(prompt, progress=gr.Progress()):
1623
  set_seed(args.seed)
1624
  width,height = list(map(int, args.resolution.split(',')))
1625
  pipe = AccDiffusionSDXLPipeline.from_pretrained(args.model_ckpt, torch_dtype=torch.float16).to("cuda")
@@ -1663,7 +1663,7 @@ if __name__ == "__main__":
1663
  )
1664
  print(images)
1665
 
1666
- return images
1667
 
1668
  css = """
1669
  #col-container{
@@ -1674,9 +1674,30 @@ if __name__ == "__main__":
1674
  with gr.Blocks(css=css) as demo:
1675
  with gr.Column(elem_id="col-container"):
1676
  gr.Markdown("# AccDiffusion: An Accurate Method for Higher-Resolution Image Generation")
 
 
 
 
 
 
 
 
 
 
 
 
 
1677
  prompt = gr.Textbox(label="Prompt")
1678
  submit_btn = gr.Button("Submit")
1679
- output_images = gr.Gallery(format="png")
 
 
 
 
 
 
 
 
1680
  submit_btn.click(
1681
  fn = infer,
1682
  inputs = [prompt],
 
1619
 
1620
  # GRADIO MODE
1621
 
1622
+ def infer(prompt, progress=gr.Progress(track_tqdm=True)):
1623
  set_seed(args.seed)
1624
  width,height = list(map(int, args.resolution.split(',')))
1625
  pipe = AccDiffusionSDXLPipeline.from_pretrained(args.model_ckpt, torch_dtype=torch.float16).to("cuda")
 
1663
  )
1664
  print(images)
1665
 
1666
+ return images[0]
1667
 
1668
  css = """
1669
  #col-container{
 
1674
  with gr.Blocks(css=css) as demo:
1675
  with gr.Column(elem_id="col-container"):
1676
  gr.Markdown("# AccDiffusion: An Accurate Method for Higher-Resolution Image Generation")
1677
+ gr.HTML("""
1678
+ <div style="display:flex;column-gap:4px;">
1679
+ <a href='https://lzhxmu.github.io/accdiffusion/accdiffusion.html'>
1680
+ <img src='https://img.shields.io/badge/Project-Page-blue'>
1681
+ </a>
1682
+ <a href='https://github.com/lzhxmu/AccDiffusion'>
1683
+ <img src='https://img.shields.io/badge/Code-blue'>
1684
+ </a>
1685
+ <a href='https://arxiv.org/abs/2407.10738v1'>
1686
+ <img src='https://img.shields.io/badge/Paper-Arxiv-red'>
1687
+ </a>
1688
+ </div>
1689
+ """)
1690
  prompt = gr.Textbox(label="Prompt")
1691
  submit_btn = gr.Button("Submit")
1692
+ output_images = gr.Image(format="png")
1693
+ gr.Examples(
1694
+ examples = [
1695
+ ["Astronaut on Mars during sunset."],
1696
+ ["A fow peeking out from behind a bush."],
1697
+ ["A cute corgi on the lawn."],
1698
+ ],
1699
+ inputs = [prompt]
1700
+ )
1701
  submit_btn.click(
1702
  fn = infer,
1703
  inputs = [prompt],