Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,25 +93,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 93 |
colored_normal_file = gr.File(label="Colored Normal Image", elem_id="download")
|
| 94 |
raw_normal_file = gr.File(label="Raw Normal Data (.npy)", elem_id="download")
|
| 95 |
|
| 96 |
-
|
| 97 |
-
# with gr.Row():
|
| 98 |
-
# input_image = gr.Image(label="Input Image", type='numpy', elem_id='img-display-input')
|
| 99 |
-
# depth_image_slider = ImageSlider(label="Depth Map with Slider View", elem_id='img-display-output', position=0.5)
|
| 100 |
-
|
| 101 |
-
# with gr.Row():
|
| 102 |
-
# submit = gr.Button(value="Compute Depth")
|
| 103 |
-
# processing_res_choice = gr.Radio(
|
| 104 |
-
# [
|
| 105 |
-
# ("Recommended (768)", 768),
|
| 106 |
-
# ("Native", 0),
|
| 107 |
-
# ],
|
| 108 |
-
# label="Processing resolution",
|
| 109 |
-
# value=768,
|
| 110 |
-
# )
|
| 111 |
-
|
| 112 |
-
# gray_depth_file = gr.File(label="Grayscale depth map", elem_id="download",)
|
| 113 |
-
# raw_file = gr.File(label="Raw Depth Data (.npy)", elem_id="download")
|
| 114 |
-
|
| 115 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
| 116 |
|
| 117 |
def on_submit(image, processing_res_choice):
|
|
@@ -150,24 +131,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 150 |
tmp_npy_normal.name
|
| 151 |
)
|
| 152 |
|
| 153 |
-
# pil_image = Image.fromarray(image.astype('uint8'))
|
| 154 |
-
# depth_npy, depth_colored = predict_depth(pil_image, processing_res_choice)
|
| 155 |
-
|
| 156 |
-
# # Save the npy data (raw depth map)
|
| 157 |
-
# tmp_npy_depth = tempfile.NamedTemporaryFile(suffix='.npy', delete=False)
|
| 158 |
-
# np.save(tmp_npy_depth.name, depth_npy)
|
| 159 |
-
|
| 160 |
-
# # Save the grayscale depth map
|
| 161 |
-
# depth_gray = (depth_npy * 65535.0).astype(np.uint16)
|
| 162 |
-
# tmp_gray_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 163 |
-
# Image.fromarray(depth_gray).save(tmp_gray_depth.name, mode="I;16")
|
| 164 |
-
|
| 165 |
-
# # Save the colored depth map
|
| 166 |
-
# tmp_colored_depth = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
|
| 167 |
-
# depth_colored.save(tmp_colored_depth.name)
|
| 168 |
-
|
| 169 |
-
# return [(image, depth_colored), tmp_gray_depth.name, tmp_npy_depth.name]
|
| 170 |
-
|
| 171 |
submit.click(on_submit, inputs=[input_image, processing_res_choice], outputs=[depth_image_slider,normal_image_slider,colored_depth_file,gray_depth_file,raw_depth_file,colored_normal_file,raw_normal_file])
|
| 172 |
|
| 173 |
example_files = os.listdir('assets/examples')
|
|
|
|
| 93 |
colored_normal_file = gr.File(label="Colored Normal Image", elem_id="download")
|
| 94 |
raw_normal_file = gr.File(label="Raw Normal Data (.npy)", elem_id="download")
|
| 95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
cmap = matplotlib.colormaps.get_cmap('Spectral_r')
|
| 97 |
|
| 98 |
def on_submit(image, processing_res_choice):
|
|
|
|
| 131 |
tmp_npy_normal.name
|
| 132 |
)
|
| 133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
submit.click(on_submit, inputs=[input_image, processing_res_choice], outputs=[depth_image_slider,normal_image_slider,colored_depth_file,gray_depth_file,raw_depth_file,colored_normal_file,raw_normal_file])
|
| 135 |
|
| 136 |
example_files = os.listdir('assets/examples')
|