NightRaven109 commited on
Commit
540e65e
·
verified ·
1 Parent(s): 303d638

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -2
app.py CHANGED
@@ -191,6 +191,43 @@ DEFAULT_VALUES = {
191
  "color_fix_method": "adain"
192
  }
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  # Create interface components
195
  with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
196
  gr.Markdown("## Controllable Conditional Super-Resolution")
@@ -200,7 +237,6 @@ with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
200
  with gr.Column():
201
  input_image = gr.Image(label="Input Image")
202
 
203
- # Put all parameters in an accordion/dropdown
204
  with gr.Accordion("Advanced Options", open=False):
205
  prompt = gr.Textbox(label="Prompt", value=DEFAULT_VALUES["prompt"])
206
  negative_prompt = gr.Textbox(label="Negative Prompt", value=DEFAULT_VALUES["negative_prompt"])
@@ -215,7 +251,6 @@ with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
215
  value=DEFAULT_VALUES["color_fix_method"]
216
  )
217
 
218
- # Add buttons
219
  with gr.Row():
220
  clear_btn = gr.Button("Clear")
221
  submit_btn = gr.Button("Submit", variant="primary")
@@ -223,6 +258,19 @@ with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
223
  with gr.Column():
224
  output_image = gr.Image(label="Generated Image")
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  # Define submit action
227
  submit_btn.click(
228
  fn=process_image,
 
191
  "color_fix_method": "adain"
192
  }
193
 
194
+ # Define example data
195
+ EXAMPLES = [
196
+ [
197
+ "examples/low_res_1.jpg", # Input image path
198
+ "clean, detailed photo, high quality, 8k resolution", # Prompt
199
+ "blurry, noise, artifacts, low quality", # Negative prompt
200
+ 3.0, # Guidance scale
201
+ 1.0, # Conditioning scale
202
+ 6, # Num steps
203
+ 42, # Seed
204
+ 4, # Upscale factor
205
+ "wavelet" # Color fix method
206
+ ],
207
+ [
208
+ "examples/low_res_2.jpg",
209
+ "sharp, crisp details, professional photo, ultra HD",
210
+ "blur, pixelated, low resolution, noise",
211
+ 3.0,
212
+ 1.0,
213
+ 6,
214
+ 123,
215
+ 4,
216
+ "wavelet"
217
+ ],
218
+ [
219
+ "examples/low_res_3.jpg",
220
+ "natural texture, fine details, pristine quality",
221
+ "artificial, smooth, blurry, low quality",
222
+ 2.5,
223
+ 1.0,
224
+ 6,
225
+ 456,
226
+ 4,
227
+ "wavelet"
228
+ ]
229
+ ]
230
+
231
  # Create interface components
232
  with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
233
  gr.Markdown("## Controllable Conditional Super-Resolution")
 
237
  with gr.Column():
238
  input_image = gr.Image(label="Input Image")
239
 
 
240
  with gr.Accordion("Advanced Options", open=False):
241
  prompt = gr.Textbox(label="Prompt", value=DEFAULT_VALUES["prompt"])
242
  negative_prompt = gr.Textbox(label="Negative Prompt", value=DEFAULT_VALUES["negative_prompt"])
 
251
  value=DEFAULT_VALUES["color_fix_method"]
252
  )
253
 
 
254
  with gr.Row():
255
  clear_btn = gr.Button("Clear")
256
  submit_btn = gr.Button("Submit", variant="primary")
 
258
  with gr.Column():
259
  output_image = gr.Image(label="Generated Image")
260
 
261
+ # Add examples
262
+ gr.Examples(
263
+ examples=EXAMPLES,
264
+ inputs=[
265
+ input_image, prompt, negative_prompt, guidance_scale,
266
+ conditioning_scale, num_steps, seed, upscale_factor,
267
+ color_fix_method
268
+ ],
269
+ outputs=output_image,
270
+ fn=process_image,
271
+ cache_examples=True # Cache the results for faster loading
272
+ )
273
+
274
  # Define submit action
275
  submit_btn.click(
276
  fn=process_image,