Update app.py
Browse files
app.py
CHANGED
|
@@ -183,19 +183,25 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
|
|
| 183 |
return str(gltf_path)
|
| 184 |
|
| 185 |
# Create Gradio interface
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
fn=process_image,
|
| 188 |
inputs=[
|
| 189 |
-
gr.
|
| 190 |
-
gr.
|
| 191 |
],
|
| 192 |
outputs=[
|
| 193 |
-
gr.
|
| 194 |
-
gr.
|
|
|
|
| 195 |
],
|
| 196 |
-
title=
|
| 197 |
-
description=
|
|
|
|
|
|
|
|
|
|
| 198 |
)
|
| 199 |
-
|
| 200 |
-
if __name__ == "__main__":
|
| 201 |
-
interface.launch()
|
|
|
|
| 183 |
return str(gltf_path)
|
| 184 |
|
| 185 |
# Create Gradio interface
|
| 186 |
+
title = "Demo: Depth Estimation & 3D Reconstruction with DPT + Point Cloud"
|
| 187 |
+
description = "This demo allows users to provide an RGB image and optionally a depth map to create a 3D object. If no depth map is provided, the DPT model will generate it."
|
| 188 |
+
examples = [["examples/" + img] for img in os.listdir("examples/")]
|
| 189 |
+
|
| 190 |
+
iface = gr.Interface(
|
| 191 |
fn=process_image,
|
| 192 |
inputs=[
|
| 193 |
+
gr.Image(type="filepath", label="Input Image"),
|
| 194 |
+
gr.Image(type="filepath", label="Input Depth Map (optional)"),
|
| 195 |
],
|
| 196 |
outputs=[
|
| 197 |
+
gr.Image(label="Predicted Depth", type="pil"),
|
| 198 |
+
gr.Model3D(label="3D Mesh Reconstruction", clear_color=[1.0, 1.0, 1.0, 1.0]),
|
| 199 |
+
gr.File(label="3D gLTF File"),
|
| 200 |
],
|
| 201 |
+
title=title,
|
| 202 |
+
description=description,
|
| 203 |
+
examples=examples,
|
| 204 |
+
allow_flagging="never",
|
| 205 |
+
cache_examples=False,
|
| 206 |
)
|
| 207 |
+
iface.launch(debug=True, show_api=True, share=True)
|
|
|
|
|
|