codic commited on
Commit
8c09b2d
·
verified ·
1 Parent(s): 2c5d8ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -7,14 +7,14 @@ from PIL import Image
7
  import open3d as o3d
8
  from pathlib import Path
9
  import os
10
- import gradio as gr # Add this import
11
- from io import BytesIO # Add import for BytesIO
12
 
13
  # Initialize Gradio client for background removal
14
  client = Client("not-lain/background-removal")
15
 
16
  # Initialize DPT depth estimation model
17
- feature_extractor = DPTImageProcessor.from_pretrained("Intel/dpt-large")
18
  model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
19
 
20
  def process_image(image_path, depth_map_path=None):
@@ -68,6 +68,7 @@ def process_image(image_path, depth_map_path=None):
68
  except Exception as e:
69
  print(f"Error: {e}")
70
  return [None, None, None] # Ensure we return three values, even on error
 
71
  def create_3d_obj(rgb_image, depth_image, image_path, depth=12):
72
  depth_o3d = o3d.geometry.Image(depth_image)
73
  image_o3d = o3d.geometry.Image(rgb_image)
 
7
  import open3d as o3d
8
  from pathlib import Path
9
  import os
10
+ import gradio as gr
11
+ from io import BytesIO
12
 
13
  # Initialize Gradio client for background removal
14
  client = Client("not-lain/background-removal")
15
 
16
  # Initialize DPT depth estimation model
17
+ feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large") # Changed from DPTImageProcessor
18
  model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
19
 
20
  def process_image(image_path, depth_map_path=None):
 
68
  except Exception as e:
69
  print(f"Error: {e}")
70
  return [None, None, None] # Ensure we return three values, even on error
71
+
72
  def create_3d_obj(rgb_image, depth_image, image_path, depth=12):
73
  depth_o3d = o3d.geometry.Image(depth_image)
74
  image_o3d = o3d.geometry.Image(rgb_image)