Update app.py
Browse files
app.py
CHANGED
|
@@ -190,16 +190,26 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
|
|
| 190 |
return output_path
|
| 191 |
|
| 192 |
# Gradio Interface
|
| 193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
fn=process_image,
|
| 195 |
inputs=[
|
| 196 |
-
gr.
|
| 197 |
-
gr.
|
| 198 |
],
|
| 199 |
outputs=[
|
| 200 |
-
gr.
|
| 201 |
-
gr.
|
|
|
|
| 202 |
],
|
| 203 |
-
title=
|
| 204 |
-
description=
|
| 205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
return output_path
|
| 191 |
|
| 192 |
# Gradio Interface
|
| 193 |
+
title = "Depth Estimation & 3D Reconstruction Demo"
|
| 194 |
+
description = "Upload an image and optionally a depth map (in .npy or image format) to generate a 3D model. If no depth map is provided, the DPT model will generate it."
|
| 195 |
+
|
| 196 |
+
examples = [["examples/" + img] for img in os.listdir("examples/")]
|
| 197 |
+
|
| 198 |
+
iface = gr.Interface(
|
| 199 |
fn=process_image,
|
| 200 |
inputs=[
|
| 201 |
+
gr.Image(type="filepath", label="Input Image"),
|
| 202 |
+
gr.File(type="filepath", label="Input Depth Map (optional)"),
|
| 203 |
],
|
| 204 |
outputs=[
|
| 205 |
+
gr.Image(label="Predicted Depth", type="pil"),
|
| 206 |
+
gr.Model3D(label="3D Mesh Reconstruction", clear_color=[1.0, 1.0, 1.0, 1.0]),
|
| 207 |
+
gr.File(label="3D gLTF File"),
|
| 208 |
],
|
| 209 |
+
title=title,
|
| 210 |
+
description=description,
|
| 211 |
+
examples=examples,
|
| 212 |
+
allow_flagging="never",
|
| 213 |
+
cache_examples=False,
|
| 214 |
+
)
|
| 215 |
+
iface.launch(debug=True, show_api=True, share=True)
|