Update app.py
Browse files
app.py
CHANGED
|
@@ -184,20 +184,26 @@ def create_3d_obj(foreground, depth_image, background, image_path, depth=10):
|
|
| 184 |
|
| 185 |
return gltf_path
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
# Gradio interface
|
| 188 |
-
|
| 189 |
fn=process_image,
|
| 190 |
inputs=[
|
| 191 |
-
gr.
|
| 192 |
-
gr.
|
| 193 |
],
|
| 194 |
outputs=[
|
| 195 |
-
gr.
|
| 196 |
-
gr.
|
|
|
|
| 197 |
],
|
| 198 |
-
title=
|
| 199 |
-
description=
|
|
|
|
|
|
|
|
|
|
| 200 |
)
|
| 201 |
-
|
| 202 |
-
# Launch the interface
|
| 203 |
-
interface.launch()
|
|
|
|
| 184 |
|
| 185 |
return gltf_path
|
| 186 |
|
| 187 |
+
title = "3D Reconstruction with DPT "
|
| 188 |
+
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."
|
| 189 |
+
examples = [["examples/" + img] for img in os.listdir("examples/")]
|
| 190 |
+
|
| 191 |
# Gradio interface
|
| 192 |
+
iface = gr.Interface(
|
| 193 |
fn=process_image,
|
| 194 |
inputs=[
|
| 195 |
+
gr.Image(type="filepath", label="Input Image"),
|
| 196 |
+
gr.Image(type="filepath", label="Input Depth Map (optional)"),
|
| 197 |
],
|
| 198 |
outputs=[
|
| 199 |
+
gr.Image(label="Predicted Depth", type="pil"),
|
| 200 |
+
gr.Model3D(label="3D Mesh Reconstruction", clear_color=[1.0, 1.0, 1.0, 1.0]),
|
| 201 |
+
gr.File(label="3D gLTF File"),
|
| 202 |
],
|
| 203 |
+
title=title,
|
| 204 |
+
description=description,
|
| 205 |
+
examples=examples,
|
| 206 |
+
allow_flagging="never",
|
| 207 |
+
cache_examples=False,
|
| 208 |
)
|
| 209 |
+
iface.launch(debug=True, show_api=True, share=True)
|
|
|
|
|
|