codic commited on
Commit
f5d7995
·
verified ·
1 Parent(s): cc940b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
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
- interface = gr.Interface(
 
 
 
 
187
  fn=process_image,
188
  inputs=[
189
- gr.inputs.Image(label="Upload Image"),
190
- gr.inputs.File(label="Upload Depth Map (optional)", type="file")
191
  ],
192
  outputs=[
193
- gr.outputs.Image(label="Processed Image"),
194
- gr.outputs.File(label="3D Model Output (GLTF)")
 
195
  ],
196
- title="Depth Estimation and 3D Model Generation",
197
- description="Upload an image and optionally a depth map to generate a 3D model."
 
 
 
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)