codic commited on
Commit
db0c43e
·
verified ·
1 Parent(s): 4a13cff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -8
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
- gr.Interface(
 
 
 
 
 
194
  fn=process_image,
195
  inputs=[
196
- gr.inputs.Image(type="filepath", label="Input Image"),
197
- gr.inputs.File(label="Depth Map (optional, .npy or image)"),
198
  ],
199
  outputs=[
200
- gr.outputs.Image(label="Processed Depth Image"),
201
- gr.outputs.File(label="3D Model (GLB)"),
 
202
  ],
203
- title="3D Reconstruction with Depth Estimation",
204
- description="Upload an image and optionally a depth map to generate a 3D model."
205
- ).launch()
 
 
 
 
 
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)