Spaces:
doevent
/
Running on Zero

ohayonguy commited on
Commit
0309251
·
1 Parent(s): b51eadf

improved interface

Browse files
Files changed (1) hide show
  1. app.py +40 -46
app.py CHANGED
@@ -253,16 +253,12 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
253
  gr.HTML(intro)
254
  gr.Markdown(markdown_top)
255
 
256
- with gr.Row():
257
- with gr.Column(scale=2):
258
  input_im = gr.Image(label="Input", type="filepath", show_label=True)
259
- with gr.Column(scale=1):
260
  num_inference_steps = gr.Slider(
261
- label="Number of Inference Steps",
262
- minimum=1,
263
- maximum=200,
264
- step=1,
265
- value=25,
266
  )
267
  upscale_factor = gr.Slider(
268
  label="Scale factor. Applicable only to non-aligned face images. This will upscale the entire image.",
@@ -271,51 +267,49 @@ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
271
  step=0.1,
272
  value=1,
273
  )
274
- seed = gr.Slider(
275
- label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42,
276
- )
277
-
278
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
279
- aligned = gr.Checkbox(
280
- label="The input is an aligned face image.", value=False
 
 
 
 
 
 
 
 
 
 
281
  )
282
 
283
- with gr.Row():
284
- with gr.Column(scale=1):
285
- run_button = gr.Button(value="Submit", variant="primary")
286
- with gr.Column(scale=1):
287
- clear_button = gr.ClearButton(value="Clear")
288
-
289
- with gr.Row():
290
- result = gr.Image(label="Output", type="numpy", show_label=True, format="png")
291
- with gr.Row():
292
- gallery = gr.Gallery(label="Restored faces gallery", type="numpy", show_label=True, format="png")
293
-
294
  clear_button.add(input_im)
295
  clear_button.add(result)
296
  clear_button.add(gallery)
297
 
298
- examples = gr.Examples(
299
- examples=[
300
- [42, False, "examples/01.png", False, 1, 25],
301
- [42, False, "examples/03.jpg", False, 2, 25],
302
- [42, False, "examples/00000055.png", True, 1, 25],
303
- [42, False, "examples/00000085.png", True, 1, 25],
304
- [42, False, "examples/00000113.png", True, 1, 25],
305
- [42, False, "examples/00000137.png", True, 1, 25],
306
- ],
307
- fn=inference,
308
- inputs=[
309
- seed,
310
- randomize_seed,
311
- input_im,
312
- aligned,
313
- upscale_factor,
314
- num_inference_steps,
315
- ],
316
- outputs=[result, gallery],
317
- cache_examples="lazy",
318
- )
 
319
 
320
  gr.Markdown(article)
321
  gr.on(
 
253
  gr.HTML(intro)
254
  gr.Markdown(markdown_top)
255
 
256
+ with gr.Column(scale=1):
257
+ with gr.Row():
258
  input_im = gr.Image(label="Input", type="filepath", show_label=True)
259
+ with gr.Row():
260
  num_inference_steps = gr.Slider(
261
+ label="Number of Inference Steps", minimum=1, maximum=200, step=1, value=25,
 
 
 
 
262
  )
263
  upscale_factor = gr.Slider(
264
  label="Scale factor. Applicable only to non-aligned face images. This will upscale the entire image.",
 
267
  step=0.1,
268
  value=1,
269
  )
270
+ seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=42)
271
+
 
 
272
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
273
+ aligned = gr.Checkbox(label="The input is an aligned face image.", value=False)
274
+ with gr.Row():
275
+ with gr.Column(scale=1):
276
+ run_button = gr.Button(value="Submit", variant="primary")
277
+ with gr.Column(scale=1):
278
+ clear_button = gr.ClearButton(value="Clear")
279
+ with gr.Column(scale=1):
280
+ with gr.Row():
281
+ result = gr.Image(label="Output", type="numpy", show_label=True, format="png")
282
+ with gr.Row():
283
+ gallery = gr.Gallery(
284
+ label="Restored faces gallery", type="numpy", show_label=True, format="png"
285
  )
286
 
 
 
 
 
 
 
 
 
 
 
 
287
  clear_button.add(input_im)
288
  clear_button.add(result)
289
  clear_button.add(gallery)
290
 
291
+ with gr.Row():
292
+ examples = gr.Examples(
293
+ examples=[
294
+ [42, False, "examples/01.png", False, 1, 25],
295
+ [42, False, "examples/03.jpg", False, 2, 25],
296
+ [42, False, "examples/00000055.png", True, 1, 25],
297
+ [42, False, "examples/00000085.png", True, 1, 25],
298
+ [42, False, "examples/00000113.png", True, 1, 25],
299
+ [42, False, "examples/00000137.png", True, 1, 25],
300
+ ],
301
+ fn=inference,
302
+ inputs=[
303
+ seed,
304
+ randomize_seed,
305
+ input_im,
306
+ aligned,
307
+ upscale_factor,
308
+ num_inference_steps,
309
+ ],
310
+ outputs=[result, gallery],
311
+ cache_examples="lazy",
312
+ )
313
 
314
  gr.Markdown(article)
315
  gr.on(