Spaces:
Running
on
Zero
Running
on
Zero
guangkaixu
commited on
Commit
•
093d444
1
Parent(s):
a02b691
Update app.py
Browse files
app.py
CHANGED
@@ -291,42 +291,42 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
|
|
291 |
directory_name="examples_image",
|
292 |
)
|
293 |
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
|
331 |
# filenames = []
|
332 |
# filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
|
@@ -428,38 +428,38 @@ def run_demo_server(pipe_depth, pipe_normal, pipe_dis):
|
|
428 |
queue=False,
|
429 |
)
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
|
464 |
# dis_image_submit_btn.click(
|
465 |
# fn=process_image_check,
|
|
|
291 |
directory_name="examples_image",
|
292 |
)
|
293 |
|
294 |
+
with gr.Tab("Normal"):
|
295 |
+
with gr.Row():
|
296 |
+
with gr.Column():
|
297 |
+
normal_image_input = gr.Image(
|
298 |
+
label="Input Image",
|
299 |
+
type="filepath",
|
300 |
+
)
|
301 |
+
with gr.Row():
|
302 |
+
normal_image_submit_btn = gr.Button(
|
303 |
+
value="Estimate Normal", variant="primary"
|
304 |
+
)
|
305 |
+
normal_image_reset_btn = gr.Button(value="Reset")
|
306 |
+
with gr.Accordion("Advanced options", open=False):
|
307 |
+
image_processing_res = gr.Radio(
|
308 |
+
[
|
309 |
+
("Native", 0),
|
310 |
+
("Recommended", 768),
|
311 |
+
],
|
312 |
+
label="Processing resolution",
|
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_files = gr.Files(
|
326 |
+
label="Normal outputs",
|
327 |
+
elem_id="download",
|
328 |
+
interactive=False,
|
329 |
+
)
|
330 |
|
331 |
# filenames = []
|
332 |
# filenames.extend(["%d.jpg" %(i+1) for i in range(10)])
|
|
|
428 |
queue=False,
|
429 |
)
|
430 |
|
431 |
+
normal_image_submit_btn.click(
|
432 |
+
fn=process_image_check,
|
433 |
+
inputs=normal_image_input,
|
434 |
+
outputs=None,
|
435 |
+
preprocess=False,
|
436 |
+
queue=False,
|
437 |
+
).success(
|
438 |
+
fn=process_pipe_normal,
|
439 |
+
inputs=[
|
440 |
+
normal_image_input,
|
441 |
+
image_processing_res,
|
442 |
+
],
|
443 |
+
outputs=[normal_image_output_slider, normal_image_output_files],
|
444 |
+
concurrency_limit=1,
|
445 |
+
)
|
446 |
|
447 |
+
normal_image_reset_btn.click(
|
448 |
+
fn=lambda: (
|
449 |
+
None,
|
450 |
+
None,
|
451 |
+
None,
|
452 |
+
default_image_processing_res,
|
453 |
+
),
|
454 |
+
inputs=[],
|
455 |
+
outputs=[
|
456 |
+
normal_image_input,
|
457 |
+
normal_image_output_slider,
|
458 |
+
normal_image_output_files,
|
459 |
+
image_processing_res,
|
460 |
+
],
|
461 |
+
queue=False,
|
462 |
+
)
|
463 |
|
464 |
# dis_image_submit_btn.click(
|
465 |
# fn=process_image_check,
|