guangkaixu commited on
Commit
6b95e7c
1 Parent(s): 1cceacf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +164 -164
app.py CHANGED
@@ -225,107 +225,107 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
225
  directory_name="examples_image",
226
  )
227
 
228
- with gr.Tab("Normal"):
229
- with gr.Row():
230
- with gr.Column():
231
- normal_image_input = gr.Image(
232
- label="Input Image",
233
- type="filepath",
234
- )
235
- with gr.Row():
236
- normal_image_submit_btn = gr.Button(
237
- value="Estimate Normal", variant="primary"
238
- )
239
- normal_image_reset_btn = gr.Button(value="Reset")
240
- with gr.Accordion("Advanced options", open=False):
241
- image_processing_res = gr.Radio(
242
- [
243
- ("Native", 0),
244
- ("Recommended", 768),
245
- ],
246
- label="Processing resolution",
247
- value=default_image_processing_res,
248
- )
249
- with gr.Column():
250
- normal_image_output_slider = ImageSlider(
251
- label="Predicted surface normal",
252
- type="filepath",
253
- show_download_button=True,
254
- show_share_button=True,
255
- interactive=False,
256
- elem_classes="slider",
257
- position=0.25,
258
- )
259
- normal_image_output_files = gr.Files(
260
- label="Normal outputs",
261
- elem_id="download",
262
- interactive=False,
263
- )
264
-
265
- filenames = []
266
- filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
267
- Examples(
268
- fn=process_pipe_normal,
269
- examples=[
270
- os.path.join("images", "normal", name)
271
- for name in filenames
272
- ],
273
- inputs=[normal_image_input],
274
- outputs=[normal_image_output_slider, normal_image_output_files],
275
- cache_examples=True,
276
- directory_name="examples_image",
277
- )
278
 
279
- with gr.Tab("Dichotomous Segmentation"):
280
- with gr.Row():
281
- with gr.Column():
282
- dis_image_input = gr.Image(
283
- label="Input Image",
284
- type="filepath",
285
- )
286
- with gr.Row():
287
- dis_image_submit_btn = gr.Button(
288
- value="Estimate Dichotomous Segmentation.", variant="primary"
289
- )
290
- dis_image_reset_btn = gr.Button(value="Reset")
291
- with gr.Accordion("Advanced options", open=False):
292
- image_processing_res = gr.Radio(
293
- [
294
- ("Native", 0),
295
- ("Recommended", 768),
296
- ],
297
- label="Processing resolution",
298
- value=default_image_processing_res,
299
- )
300
- with gr.Column():
301
- dis_image_output_slider = ImageSlider(
302
- label="Predicted dichotomous image segmentation",
303
- type="filepath",
304
- show_download_button=True,
305
- show_share_button=True,
306
- interactive=False,
307
- elem_classes="slider",
308
- position=0.25,
309
- )
310
- dis_image_output_files = gr.Files(
311
- label="DIS outputs",
312
- elem_id="download",
313
- interactive=False,
314
- )
315
-
316
- filenames = []
317
- filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
318
- Examples(
319
- fn=process_pipe_dis,
320
- examples=[
321
- os.path.join("images", "dis", name)
322
- for name in filenames
323
- ],
324
- inputs=[dis_image_input],
325
- outputs=[dis_image_output_slider, dis_image_output_files],
326
- cache_examples=True,
327
- directory_name="examples_image",
328
- )
329
 
330
 
331
  ### Image tab
@@ -362,71 +362,71 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
362
  queue=False,
363
  )
364
 
365
- normal_image_submit_btn.click(
366
- fn=process_image_check,
367
- inputs=normal_image_input,
368
- outputs=None,
369
- preprocess=False,
370
- queue=False,
371
- ).success(
372
- fn=process_pipe_normal,
373
- inputs=[
374
- normal_image_input,
375
- image_processing_res,
376
- ],
377
- outputs=[normal_image_output_slider, normal_image_output_files],
378
- concurrency_limit=1,
379
- )
380
-
381
- normal_image_reset_btn.click(
382
- fn=lambda: (
383
- None,
384
- None,
385
- None,
386
- default_image_processing_res,
387
- ),
388
- inputs=[],
389
- outputs=[
390
- normal_image_input,
391
- normal_image_output_slider,
392
- normal_image_output_files,
393
- image_processing_res,
394
- ],
395
- queue=False,
396
- )
397
 
398
- dis_image_submit_btn.click(
399
- fn=process_image_check,
400
- inputs=dis_image_input,
401
- outputs=None,
402
- preprocess=False,
403
- queue=False,
404
- ).success(
405
- fn=process_pipe_dis,
406
- inputs=[
407
- dis_image_input,
408
- image_processing_res,
409
- ],
410
- outputs=[dis_image_output_slider, dis_image_output_files],
411
- concurrency_limit=1,
412
- )
413
-
414
- dis_image_reset_btn.click(
415
- fn=lambda: (
416
- None,
417
- None,
418
- None,
419
- default_image_processing_res,
420
- ),
421
- inputs=[],
422
- outputs=[
423
- dis_image_input,
424
- dis_image_output_slider,
425
- dis_image_output_files,
426
- image_processing_res,
427
- ],
428
- queue=False,
429
- )
430
 
431
  ### Server launch
432
 
 
225
  directory_name="examples_image",
226
  )
227
 
228
+ # with gr.Tab("Normal"):
229
+ # with gr.Row():
230
+ # with gr.Column():
231
+ # normal_image_input = gr.Image(
232
+ # label="Input Image",
233
+ # type="filepath",
234
+ # )
235
+ # with gr.Row():
236
+ # normal_image_submit_btn = gr.Button(
237
+ # value="Estimate Normal", variant="primary"
238
+ # )
239
+ # normal_image_reset_btn = gr.Button(value="Reset")
240
+ # with gr.Accordion("Advanced options", open=False):
241
+ # image_processing_res = gr.Radio(
242
+ # [
243
+ # ("Native", 0),
244
+ # ("Recommended", 768),
245
+ # ],
246
+ # label="Processing resolution",
247
+ # value=default_image_processing_res,
248
+ # )
249
+ # with gr.Column():
250
+ # normal_image_output_slider = ImageSlider(
251
+ # label="Predicted surface normal",
252
+ # type="filepath",
253
+ # show_download_button=True,
254
+ # show_share_button=True,
255
+ # interactive=False,
256
+ # elem_classes="slider",
257
+ # position=0.25,
258
+ # )
259
+ # normal_image_output_files = gr.Files(
260
+ # label="Normal outputs",
261
+ # elem_id="download",
262
+ # interactive=False,
263
+ # )
264
+
265
+ # filenames = []
266
+ # filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
267
+ # Examples(
268
+ # fn=process_pipe_normal,
269
+ # examples=[
270
+ # os.path.join("images", "normal", name)
271
+ # for name in filenames
272
+ # ],
273
+ # inputs=[normal_image_input],
274
+ # outputs=[normal_image_output_slider, normal_image_output_files],
275
+ # cache_examples=True,
276
+ # directory_name="examples_image",
277
+ # )
278
 
279
+ # with gr.Tab("Dichotomous Segmentation"):
280
+ # with gr.Row():
281
+ # with gr.Column():
282
+ # dis_image_input = gr.Image(
283
+ # label="Input Image",
284
+ # type="filepath",
285
+ # )
286
+ # with gr.Row():
287
+ # dis_image_submit_btn = gr.Button(
288
+ # value="Estimate Dichotomous Segmentation.", variant="primary"
289
+ # )
290
+ # dis_image_reset_btn = gr.Button(value="Reset")
291
+ # with gr.Accordion("Advanced options", open=False):
292
+ # image_processing_res = gr.Radio(
293
+ # [
294
+ # ("Native", 0),
295
+ # ("Recommended", 768),
296
+ # ],
297
+ # label="Processing resolution",
298
+ # value=default_image_processing_res,
299
+ # )
300
+ # with gr.Column():
301
+ # dis_image_output_slider = ImageSlider(
302
+ # label="Predicted dichotomous image segmentation",
303
+ # type="filepath",
304
+ # show_download_button=True,
305
+ # show_share_button=True,
306
+ # interactive=False,
307
+ # elem_classes="slider",
308
+ # position=0.25,
309
+ # )
310
+ # dis_image_output_files = gr.Files(
311
+ # label="DIS outputs",
312
+ # elem_id="download",
313
+ # interactive=False,
314
+ # )
315
+
316
+ # filenames = []
317
+ # filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
318
+ # Examples(
319
+ # fn=process_pipe_dis,
320
+ # examples=[
321
+ # os.path.join("images", "dis", name)
322
+ # for name in filenames
323
+ # ],
324
+ # inputs=[dis_image_input],
325
+ # outputs=[dis_image_output_slider, dis_image_output_files],
326
+ # cache_examples=True,
327
+ # directory_name="examples_image",
328
+ # )
329
 
330
 
331
  ### Image tab
 
362
  queue=False,
363
  )
364
 
365
+ # normal_image_submit_btn.click(
366
+ # fn=process_image_check,
367
+ # inputs=normal_image_input,
368
+ # outputs=None,
369
+ # preprocess=False,
370
+ # queue=False,
371
+ # ).success(
372
+ # fn=process_pipe_normal,
373
+ # inputs=[
374
+ # normal_image_input,
375
+ # image_processing_res,
376
+ # ],
377
+ # outputs=[normal_image_output_slider, normal_image_output_files],
378
+ # concurrency_limit=1,
379
+ # )
380
+
381
+ # normal_image_reset_btn.click(
382
+ # fn=lambda: (
383
+ # None,
384
+ # None,
385
+ # None,
386
+ # default_image_processing_res,
387
+ # ),
388
+ # inputs=[],
389
+ # outputs=[
390
+ # normal_image_input,
391
+ # normal_image_output_slider,
392
+ # normal_image_output_files,
393
+ # image_processing_res,
394
+ # ],
395
+ # queue=False,
396
+ # )
397
 
398
+ # dis_image_submit_btn.click(
399
+ # fn=process_image_check,
400
+ # inputs=dis_image_input,
401
+ # outputs=None,
402
+ # preprocess=False,
403
+ # queue=False,
404
+ # ).success(
405
+ # fn=process_pipe_dis,
406
+ # inputs=[
407
+ # dis_image_input,
408
+ # image_processing_res,
409
+ # ],
410
+ # outputs=[dis_image_output_slider, dis_image_output_files],
411
+ # concurrency_limit=1,
412
+ # )
413
+
414
+ # dis_image_reset_btn.click(
415
+ # fn=lambda: (
416
+ # None,
417
+ # None,
418
+ # None,
419
+ # default_image_processing_res,
420
+ # ),
421
+ # inputs=[],
422
+ # outputs=[
423
+ # dis_image_input,
424
+ # dis_image_output_slider,
425
+ # dis_image_output_files,
426
+ # image_processing_res,
427
+ # ],
428
+ # queue=False,
429
+ # )
430
 
431
  ### Server launch
432