jeasinema commited on
Commit
4ca9ea8
1 Parent(s): cebb2a5

update gradio

Browse files
Files changed (1) hide show
  1. app.py +52 -34
app.py CHANGED
@@ -65,44 +65,62 @@ outputs = gr.Image(label="Generated Image")
65
 
66
 
67
  # Custom HTML content
68
- # article_html = """
69
- # <div style="text-align: center; max-width: 1200px; margin: 20px auto;">
70
- # <h1 style="font-weight: 900; font-size: 3rem; margin-bottom: 0.5rem">🖼️ Stable Diffusion 3 Image Editor</h1>
71
- # <h2 style="font-weight: 450; font-size: 1rem; margin: 0rem">
72
- # This interface allows you to perform image editing using the Stable Diffusion 3 model trained with the UltraEdit dataset.
73
- # </h2>
74
- # <h2 style="font-weight: 450; font-size: 1rem; margin: 0.7rem auto; max-width: 1000px">
75
- # Supports both free-form (without mask) and region-based (with mask) image editing. Use the sliders to adjust the inference steps and guidance scales, and provide a seed for reproducibility.
76
- # </h2>
77
- # <h2 style="font-weight: 450; font-size: 1rem; margin: 1rem auto; max-width: 1000px">
78
- # <b>UltraEdit: Instruction-based Fine-Grained Image Editing at Scale</b>
79
- # </h2>
80
- # <div style="text-align: left; max-width: 1000px; margin: 0 auto;">
81
- # <p>
82
- # Haozhe Zhao<sup>1*</sup>, Xiaojian Ma<sup>2*</sup>, Liang Chen<sup>1</sup>, Shuzheng Si<sup>1</sup>, Rujie Wu<sup>1</sup>, Kaikai An<sup>1</sup>, Peiyu Yu<sup>3</sup>, Minjia Zhang<sup>4</sup>, Qing Li<sup>2</sup>, Baobao Chang<sup>2</sup>
83
- # <br>
84
- # <sup>1</sup>Peking University, <sup>2</sup>BIGAI, <sup>3</sup>UCLA, <sup>4</sup>UIUC
85
- # </p>
86
- # <p>
87
- # This paper presents ULTRAEDIT, a large-scale (~4M editing samples), automatically generated dataset for instruction-based image editing. Our key idea is to address the drawbacks in existing image editing datasets like InstructPix2Pix and MagicBrush, and provide a systematic approach to producing massive and high-quality image editing samples. ULTRAEDIT offers several distinct advantages:
88
- # </p>
89
- # <ul>
90
- # <li>It features a broader range of editing instructions by leveraging the creativity of large language models (LLMs) alongside in-context editing examples from human raters.</li>
91
- # <li>Its data sources are based on real images, including photographs and artworks, which provide greater diversity and reduced bias compared to datasets solely generated by text-to-image models.</li>
92
- # <li>It also supports region-based editing, enhanced by high-quality, automatically produced region annotations.</li>
93
- # </ul>
94
- # <p>
95
- # Our experiments show that canonical diffusion-based editing baselines trained on ULTRAEDIT set new records on MagicBrush and Emu-Edit benchmarks. Our analysis further confirms the crucial role of real image anchors and region-based editing data. The dataset, code, and models will be made public.
96
- # </p>
97
- # </div>
98
- # </div>
99
- # """
100
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  demo = gr.Interface(
102
  fn=generate,
103
  inputs=inputs,
104
  outputs=outputs,
105
- # title=article_html # Add article parameter
 
106
  )
107
 
108
  demo.queue().launch()
 
65
 
66
 
67
  # Custom HTML content
68
+ article_html = """
69
+ <div style="text-align: center; max-width: 1000px; margin: 20px auto; font-family: Arial, sans-serif;">
70
+ <h2 style="font-weight: 900; font-size: 2.5rem; margin-bottom: 0.5rem;">
71
+ 🖼️ UltraEdit for Fine-Grained Image Editing
72
+ </h2>
73
+ <div style="margin-bottom: 1rem;">
74
+ <h3 style="font-weight: 500; font-size: 1.25rem; margin: 0;">
75
+ </h3>
76
+ <p style="font-weight: 400; font-size: 1rem; margin: 0.5rem 0;">
77
+ Haozhe Zhao<sup>1*</sup>, Xiaojian Ma<sup>2*</sup>, Liang Chen<sup>1</sup>, Shuzheng Si<sup>1</sup>, Rujie Wu<sup>1</sup>,
78
+ Kaikai An<sup>1</sup>, Peiyu Yu<sup>3</sup>, Minjia Zhang<sup>4</sup>, Qing Li<sup>2</sup>, Baobao Chang<sup>2</sup>
79
+ </p>
80
+ <p style="font-weight: 400; font-size: 1rem; margin: 0;">
81
+ <sup>1</sup>Peking University, <sup>2</sup>BIGAI, <sup>3</sup>UCLA, <sup>4</sup>UIUC
82
+ </p>
83
+ </div>
84
+ <div style="margin: 1rem 0; display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap;">
85
+ <a href="https://huggingface.co/datasets/BleachNick/UltraEdit" style="display: flex; align-items: center; text-decoration: none; color: blue; font-weight: bold; gap: 0.5rem;">
86
+ <img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Dataset_4M" style="height: 20px; vertical-align: middle;"> Dataset
87
+ </a>
88
+ <a href="https://huggingface.co/datasets/BleachNick/UltraEdit_500k" style="display: flex; align-items: center; text-decoration: none; color: blue; font-weight: bold; gap: 0.5rem;">
89
+ <img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Dataset_500k" style="height: 20px; vertical-align: middle;"> Dataset
90
+ </a>
91
+ <a href="https://ultra-editing.github.io/" style="display: flex; align-items: center; text-decoration: none; color: blue; font-weight: bold; gap: 0.5rem;">
92
+ <span style="font-size: 20px; vertical-align: middle;">🔗</span> Page
93
+ </a>
94
+ <a href="https://huggingface.co/BleachNick/SD3_UltraEdit_w_mask" style="display: flex; align-items: center; text-decoration: none; color: blue; font-weight: bold; gap: 0.5rem;">
95
+ <img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Checkpoint" style="height: 20px; vertical-align: middle;"> Checkpoint
96
+ </a>
97
+ <a href="https://github.com/HaozheZhao/UltraEdit" style="display: flex; align-items: center; text-decoration: none; color: blue; font-weight: bold; gap: 0.5rem;">
98
+ <img src="https://upload.wikimedia.org/wikipedia/commons/9/91/Octicons-mark-github.svg" alt="GitHub" style="height: 20px; vertical-align: middle;"> GitHub
99
+ </a>
100
+ </div>
101
+ <div style="text-align: left; margin: 0 auto; font-size: 1rem; line-height: 1.5;">
102
+ <p>
103
+ <b>UltraEdit</b> is a dataset designed for fine-grained, instruction-based image editing. It contains over 4 million free-form image editing samples and more than 100,000 region-based image editing samples, automatically generated with real images as anchors.
104
+ </p>
105
+ <p>
106
+ This demo allows you to perform image editing using the Stable Diffusion 3 model trained with this extensive dataset. It supports both free-form (without mask) and region-based (with mask) image editing. Use the sliders to adjust the inference steps and guidance scales, and provide a seed for reproducibility. The image guidance scale of 1.5 and text guidance scale of 7.5 / 12.5 is a good start for free-from/region-based image editing.
107
+ </p>
108
+ </div>
109
+ </div>
110
+ """
111
+ html='''
112
+ <div style="text-align: left; margin-top: 2rem; font-size: 0.85rem; color: gray;">
113
+ <p>
114
+ <b>Usage Instructions:</b> You need to upload the images and prompts for editing. Use the pen tool to mark the areas you want to edit. If no region is marked, it will resort to free-form editing.
115
+ </p>
116
+ </div>
117
+ '''
118
  demo = gr.Interface(
119
  fn=generate,
120
  inputs=inputs,
121
  outputs=outputs,
122
+ description=article_html, # Add article parameter
123
+ article = html
124
  )
125
 
126
  demo.queue().launch()