guangkaixu commited on
Commit
3c16620
1 Parent(s): a9d6e82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -35
app.py CHANGED
@@ -121,12 +121,10 @@ def process_normal(
121
 
122
  np.save(path_out_fp32, depth_pred)
123
  depth_colored.save(path_out_vis)
124
-
125
- path_out_16bit = None
126
 
127
  return (
128
- [path_out_16bit, path_out_vis],
129
- [path_out_16bit, path_out_fp32, path_out_vis],
130
  )
131
 
132
  def process_dis(
@@ -156,12 +154,10 @@ def process_dis(
156
 
157
  np.save(path_out_fp32, depth_pred)
158
  depth_colored.save(path_out_vis)
159
-
160
- path_out_16bit = None
161
 
162
  return (
163
- [path_out_16bit, path_out_vis],
164
- [path_out_16bit, path_out_fp32, path_out_vis],
165
  )
166
 
167
  def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
@@ -277,9 +273,9 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
277
  )
278
 
279
  filenames = []
280
- filenames.extend(["anime_%d.jpg" %(i+1) for i in range(7)])
281
- filenames.extend(["line_%d.jpg" %(i+1) for i in range(6)])
282
- filenames.extend(["real_%d.jpg" %(i+1) for i in range(24)])
283
 
284
  example_folder = os.path.join(os.path.dirname(__file__), "./images")
285
  Examples(
@@ -317,15 +313,16 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
317
  value=default_image_processing_res,
318
  )
319
  with gr.Column():
320
- normal_image_output_slider = ImageSlider(
321
- label="Predicted surface normal",
322
- type="filepath",
323
- show_download_button=True,
324
- show_share_button=True,
325
- interactive=False,
326
- elem_classes="slider",
327
- position=0.25,
328
- )
 
329
  normal_image_output_files = gr.Files(
330
  label="Normal outputs",
331
  elem_id="download",
@@ -342,7 +339,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
342
  for name in filenames
343
  ],
344
  inputs=[normal_image_input],
345
- outputs=[normal_image_output_slider, normal_image_output_files],
346
  # cache_examples=True,
347
  # directory_name="examples_normal",
348
  cache_examples=False,
@@ -370,15 +367,16 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
370
  value=default_image_processing_res,
371
  )
372
  with gr.Column():
373
- dis_image_output_slider = ImageSlider(
374
- label="Predicted dichotomous image segmentation",
375
- type="filepath",
376
- show_download_button=True,
377
- show_share_button=True,
378
- interactive=False,
379
- elem_classes="slider",
380
- position=0.25,
381
- )
 
382
  dis_image_output_files = gr.Files(
383
  label="DIS outputs",
384
  elem_id="download",
@@ -395,7 +393,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
395
  for name in filenames
396
  ],
397
  inputs=[dis_image_input],
398
- outputs=[dis_image_output_slider, dis_image_output_files],
399
  # cache_examples=True,
400
  # directory_name="examples_dis",
401
  cache_examples=False,
@@ -448,7 +446,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
448
  normal_image_input,
449
  image_processing_res,
450
  ],
451
- outputs=[normal_image_output_slider, normal_image_output_files],
452
  concurrency_limit=1,
453
  )
454
 
@@ -462,7 +460,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
462
  inputs=[],
463
  outputs=[
464
  normal_image_input,
465
- normal_image_output_slider,
466
  normal_image_output_files,
467
  image_processing_res,
468
  ],
@@ -481,7 +479,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
481
  dis_image_input,
482
  image_processing_res,
483
  ],
484
- outputs=[dis_image_output_slider, dis_image_output_files],
485
  concurrency_limit=1,
486
  )
487
 
@@ -495,7 +493,7 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
495
  inputs=[],
496
  outputs=[
497
  dis_image_input,
498
- dis_image_output_slider,
499
  dis_image_output_files,
500
  image_processing_res,
501
  ],
 
121
 
122
  np.save(path_out_fp32, depth_pred)
123
  depth_colored.save(path_out_vis)
 
 
124
 
125
  return (
126
+ [path_out_vis],
127
+ [path_out_fp32, path_out_vis],
128
  )
129
 
130
  def process_dis(
 
154
 
155
  np.save(path_out_fp32, depth_pred)
156
  depth_colored.save(path_out_vis)
 
 
157
 
158
  return (
159
+ path_out_vis],
160
+ [path_out_fp32, path_out_vis],
161
  )
162
 
163
  def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
 
273
  )
274
 
275
  filenames = []
276
+ filenames.extend(["depth_anime_%d.jpg" %(i+1) for i in range(7)])
277
+ filenames.extend(["depth_line_%d.jpg" %(i+1) for i in range(6)])
278
+ filenames.extend(["depth_real_%d.jpg" %(i+1) for i in range(24)])
279
 
280
  example_folder = os.path.join(os.path.dirname(__file__), "./images")
281
  Examples(
 
313
  value=default_image_processing_res,
314
  )
315
  with gr.Column():
316
+ # normal_image_output_slider = ImageSlider(
317
+ # label="Predicted surface normal",
318
+ # type="filepath",
319
+ # show_download_button=True,
320
+ # show_share_button=True,
321
+ # interactive=False,
322
+ # elem_classes="slider",
323
+ # position=0.25,
324
+ # )
325
+ normal_image_output = gr.Gallery(label='Output', show_label=False, elem_id="gallery", columns=[1], height='auto')
326
  normal_image_output_files = gr.Files(
327
  label="Normal outputs",
328
  elem_id="download",
 
339
  for name in filenames
340
  ],
341
  inputs=[normal_image_input],
342
+ outputs=[normal_image_output, normal_image_output_files],
343
  # cache_examples=True,
344
  # directory_name="examples_normal",
345
  cache_examples=False,
 
367
  value=default_image_processing_res,
368
  )
369
  with gr.Column():
370
+ # dis_image_output_slider = ImageSlider(
371
+ # label="Predicted dichotomous image segmentation",
372
+ # type="filepath",
373
+ # show_download_button=True,
374
+ # show_share_button=True,
375
+ # interactive=False,
376
+ # elem_classes="slider",
377
+ # position=0.25,
378
+ # )
379
+ dis_image_output = gr.Gallery(label='Output', show_label=False, elem_id="gallery", columns=[1], height='auto')
380
  dis_image_output_files = gr.Files(
381
  label="DIS outputs",
382
  elem_id="download",
 
393
  for name in filenames
394
  ],
395
  inputs=[dis_image_input],
396
+ outputs=[dis_image_output, dis_image_output_files],
397
  # cache_examples=True,
398
  # directory_name="examples_dis",
399
  cache_examples=False,
 
446
  normal_image_input,
447
  image_processing_res,
448
  ],
449
+ outputs=[normal_image_output, normal_image_output_files],
450
  concurrency_limit=1,
451
  )
452
 
 
460
  inputs=[],
461
  outputs=[
462
  normal_image_input,
463
+ normal_image_output,
464
  normal_image_output_files,
465
  image_processing_res,
466
  ],
 
479
  dis_image_input,
480
  image_processing_res,
481
  ],
482
+ outputs=[dis_image_output, dis_image_output_files],
483
  concurrency_limit=1,
484
  )
485
 
 
493
  inputs=[],
494
  outputs=[
495
  dis_image_input,
496
+ dis_image_output,
497
  dis_image_output_files,
498
  image_processing_res,
499
  ],