owiedotch commited on
Commit
f21463b
1 Parent(s): ba5770d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -36
app.py CHANGED
@@ -159,45 +159,33 @@ def process(
159
 
160
  return preds
161
 
162
- MARKDOWN = \
163
- """
164
- ## Improving the Stability of Diffusion Models for Content Consistent Super-Resolution
165
-
166
- [GitHub](https://github.com/csslc/CCSR) | [Paper](https://arxiv.org/pdf/2401.00877.pdf) | [Project Page](https://csslc.github.io/project-CCSR/)
167
-
168
- If CCSR is helpful for you, please help star the GitHub Repo. Thanks!
169
- """
170
-
171
  block = gr.Blocks().queue()
172
  with block:
173
  with gr.Row():
174
- gr.Markdown(MARKDOWN)
175
- with gr.Row():
176
- with gr.Column():
177
- input_image = gr.Image(source="upload", type="pil", label="Input Image")
178
- run_button = gr.Button(label="Run")
179
- with gr.Accordion("Options", open=True):
180
- num_samples = gr.Slider(label="Number Of Samples", minimum=1, maximum=12, value=1, step=1, info="Number of output images to generate.")
181
- sr_scale = gr.Dropdown(label="SR Scale", choices=["2x", "4x", "8x"], value="4x", info="Super-resolution scale factor.")
182
- strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01, info="Strength of the control signal.")
183
- positive_prompt = gr.Textbox(label="Positive Prompt", value="", info="Positive text prompt to guide the image generation.")
184
- negative_prompt = gr.Textbox(
185
- label="Negative Prompt",
186
- value="longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
187
- info="Negative text prompt to avoid undesirable features."
188
- )
189
- cfg_scale = gr.Slider(label="Classifier Free Guidance Scale", minimum=0.1, maximum=30.0, value=1.0, step=0.1, info="Scale for classifier-free guidance.")
190
- steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=45, step=1, info="Number of diffusion steps.")
191
- use_color_fix = gr.Checkbox(label="Use Color Correction", value=True, info="Apply color correction to the output image.")
192
- seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, value=231, info="Random seed for reproducibility. Set to -1 for a random seed.")
193
- tile_diffusion = gr.Checkbox(label="Tile diffusion", value=False, info="Enable tiled diffusion for large images.")
194
- tile_diffusion_size = gr.Slider(label="Tile diffusion size", minimum=512, maximum=1024, value=512, step=256, info="Size of each tile for tiled diffusion.")
195
- tile_diffusion_stride = gr.Slider(label="Tile diffusion stride", minimum=256, maximum=512, value=256, step=128, info="Stride between tiles for tiled diffusion.")
196
- tile_vae = gr.Checkbox(label="Tile VAE", value=True, info="Enable tiled VAE for large images.")
197
- vae_encoder_tile_size = gr.Slider(label="Encoder tile size", minimum=512, maximum=5000, value=1024, step=256, info="Size of each tile for the VAE encoder.")
198
- vae_decoder_tile_size = gr.Slider(label="Decoder tile size", minimum=64, maximum=512, value=224, step=128, info="Size of each tile for the VAE decoder.")
199
- with gr.Column():
200
- result_gallery = gr.Gallery(label="Output", show_label=False, elem_id="gallery").style(grid=2, height="auto")
201
 
202
  inputs = [
203
  input_image,
 
159
 
160
  return preds
161
 
 
 
 
 
 
 
 
 
 
162
  block = gr.Blocks().queue()
163
  with block:
164
  with gr.Row():
165
+ input_image = gr.Image(type="pil", label="Input Image")
166
+ run_button = gr.Button(label="Run")
167
+ with gr.Accordion("Options", open=True):
168
+ num_samples = gr.Slider(label="Number Of Samples", minimum=1, maximum=12, value=1, step=1, info="Number of output images to generate.")
169
+ sr_scale = gr.Dropdown(label="SR Scale", choices=["2x", "4x", "8x"], value="4x", info="Super-resolution scale factor.")
170
+ strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01, info="Strength of the control signal.")
171
+ positive_prompt = gr.Textbox(label="Positive Prompt", value="", info="Positive text prompt to guide the image generation.")
172
+ negative_prompt = gr.Textbox(
173
+ label="Negative Prompt",
174
+ value="longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
175
+ info="Negative text prompt to avoid undesirable features."
176
+ )
177
+ cfg_scale = gr.Slider(label="Classifier Free Guidance Scale", minimum=0.1, maximum=30.0, value=1.0, step=0.1, info="Scale for classifier-free guidance.")
178
+ steps = gr.Slider(label="Steps", minimum=1, maximum=100, value=45, step=1, info="Number of diffusion steps.")
179
+ use_color_fix = gr.Checkbox(label="Use Color Correction", value=True, info="Apply color correction to the output image.")
180
+ seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, step=1, value=231, info="Random seed for reproducibility. Set to -1 for a random seed.")
181
+ tile_diffusion = gr.Checkbox(label="Tile diffusion", value=False, info="Enable tiled diffusion for large images.")
182
+ tile_diffusion_size = gr.Slider(label="Tile diffusion size", minimum=512, maximum=1024, value=512, step=256, info="Size of each tile for tiled diffusion.")
183
+ tile_diffusion_stride = gr.Slider(label="Tile diffusion stride", minimum=256, maximum=512, value=256, step=128, info="Stride between tiles for tiled diffusion.")
184
+ tile_vae = gr.Checkbox(label="Tile VAE", value=True, info="Enable tiled VAE for large images.")
185
+ vae_encoder_tile_size = gr.Slider(label="Encoder tile size", minimum=512, maximum=5000, value=1024, step=256, info="Size of each tile for the VAE encoder.")
186
+ vae_decoder_tile_size = gr.Slider(label="Decoder tile size", minimum=64, maximum=512, value=224, step=128, info="Size of each tile for the VAE decoder.")
187
+ with gr.Column():
188
+ result_gallery = gr.Gallery(label="Output", show_label=False, elem_id="gallery").style(grid=2, height="auto")
 
 
 
189
 
190
  inputs = [
191
  input_image,