Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -118,17 +118,32 @@ def predict(img_rgb: np.ndarray):
|
|
| 118 |
return depth_color_rgb, depth_gray, npy_path
|
| 119 |
|
| 120 |
# ================== Gradio UI ==================
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
demo.launch(
|
| 134 |
server_name="0.0.0.0",
|
|
|
|
| 118 |
return depth_color_rgb, depth_gray, npy_path
|
| 119 |
|
| 120 |
# ================== Gradio UI ==================
|
| 121 |
+
example_paths = [
|
| 122 |
+
"hfdemo/01.jpg",
|
| 123 |
+
"hfdemo/02.jpg",
|
| 124 |
+
"hfdemo/03.jpg",
|
| 125 |
+
"hfdemo/04.jpg",
|
| 126 |
+
"hfdemo/05.jpg",
|
| 127 |
+
"hfdemo/06.jpg",
|
| 128 |
+
]
|
| 129 |
+
|
| 130 |
+
with gr.Blocks() as demo:
|
| 131 |
+
gr.Markdown("# DAP Depth Prediction Demo\nChoose an example or upload your own image.")
|
| 132 |
+
|
| 133 |
+
inp = gr.Image(type="numpy", label="Input Image")
|
| 134 |
+
out_color = gr.Image(type="numpy", label="Depth (Color)")
|
| 135 |
+
out_gray = gr.Image(type="numpy", label="Depth (Gray)")
|
| 136 |
+
out_npy = gr.File(label="Depth (.npy)")
|
| 137 |
+
|
| 138 |
+
btn = gr.Button("Run")
|
| 139 |
+
|
| 140 |
+
btn.click(fn=predict, inputs=inp, outputs=[out_color, out_gray, out_npy])
|
| 141 |
+
|
| 142 |
+
gr.Examples(
|
| 143 |
+
examples=example_paths,
|
| 144 |
+
inputs=inp,
|
| 145 |
+
label="Examples (click to load)",
|
| 146 |
+
)
|
| 147 |
|
| 148 |
demo.launch(
|
| 149 |
server_name="0.0.0.0",
|