Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,7 +98,18 @@ with gr.Blocks(css=css) as demo:
|
|
| 98 |
with gr.Row():
|
| 99 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
| 100 |
depth_image_slider = ImageSlider(label="Depth Map with Slider View", elem_id='img-display-output', position=0.5)
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download",)
|
| 103 |
raw_file = gr.File(label="16-bit raw output (can be considered as disparity)", elem_id="download",)
|
| 104 |
|
|
@@ -146,11 +157,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 146 |
|
| 147 |
# return [(original_image, colored_depth), tmp_gray_depth.name, tmp_raw_depth.name]
|
| 148 |
|
| 149 |
-
submit.click(on_submit, inputs=[input_image], outputs=[depth_image_slider, gray_depth_file, raw_file])
|
| 150 |
|
| 151 |
example_files = os.listdir('assets/examples')
|
| 152 |
example_files.sort()
|
| 153 |
example_files = [os.path.join('assets/examples', filename) for filename in example_files]
|
|
|
|
| 154 |
examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[depth_image_slider, gray_depth_file, raw_file], fn=on_submit)
|
| 155 |
|
| 156 |
|
|
|
|
| 98 |
with gr.Row():
|
| 99 |
input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
| 100 |
depth_image_slider = ImageSlider(label="Depth Map with Slider View", elem_id='img-display-output', position=0.5)
|
| 101 |
+
|
| 102 |
+
withgr.Row()
|
| 103 |
+
submit = gr.Button(value="Compute Depth")
|
| 104 |
+
processing_res_choice = gr.Radio(
|
| 105 |
+
[
|
| 106 |
+
("Recommended (768)", 768),
|
| 107 |
+
("Native", 0),
|
| 108 |
+
],
|
| 109 |
+
label="Processing resolution",
|
| 110 |
+
value=768,
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download",)
|
| 114 |
raw_file = gr.File(label="16-bit raw output (can be considered as disparity)", elem_id="download",)
|
| 115 |
|
|
|
|
| 157 |
|
| 158 |
# return [(original_image, colored_depth), tmp_gray_depth.name, tmp_raw_depth.name]
|
| 159 |
|
| 160 |
+
submit.click(on_submit, inputs=[input_image, processing_res_choice], outputs=[depth_image_slider, gray_depth_file, raw_file])
|
| 161 |
|
| 162 |
example_files = os.listdir('assets/examples')
|
| 163 |
example_files.sort()
|
| 164 |
example_files = [os.path.join('assets/examples', filename) for filename in example_files]
|
| 165 |
+
example_files = [[image, 768] for image in example_files]
|
| 166 |
examples = gr.Examples(examples=example_files, inputs=[input_image], outputs=[depth_image_slider, gray_depth_file, raw_file], fn=on_submit)
|
| 167 |
|
| 168 |
|