codic commited on
Commit
c56b2b1
·
verified ·
1 Parent(s): 413b1a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
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
- interface = gr.Interface(
189
  fn=process_image,
190
  inputs=[
191
- gr.inputs.Image(type="filepath", label="Input Image"),
192
- gr.inputs.File(label="Depth Map (.npy or .png)", optional=True),
193
  ],
194
  outputs=[
195
- gr.outputs.Image(type="pil", label="Processed Depth Map"),
196
- gr.outputs.File(label="3D Model (GLTF)", label="Download GLTF"),
 
197
  ],
198
- title="3D Model Reconstruction",
199
- description="Upload an image to generate a 3D model with depth estimation.",
 
 
 
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)