Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from PIL import Image
|
|
| 6 |
import open3d as o3d
|
| 7 |
from pathlib import Path
|
| 8 |
import os
|
| 9 |
-
from gradio_client import Client
|
| 10 |
|
| 11 |
# Initialize feature extractor and model for depth estimation
|
| 12 |
feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large")
|
|
@@ -24,10 +24,11 @@ def process_image(image_path, depth_map_path=None):
|
|
| 24 |
)
|
| 25 |
|
| 26 |
# Step 1: Perform background removal
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
# Load the foreground image from the returned file path
|
| 33 |
foreground_image_path = result # This contains the path to the processed image
|
|
|
|
| 6 |
import open3d as o3d
|
| 7 |
from pathlib import Path
|
| 8 |
import os
|
| 9 |
+
from gradio_client import Client
|
| 10 |
|
| 11 |
# Initialize feature extractor and model for depth estimation
|
| 12 |
feature_extractor = DPTFeatureExtractor.from_pretrained("Intel/dpt-large")
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
# Step 1: Perform background removal
|
| 27 |
+
result = client.predict(
|
| 28 |
+
f=image_path, # Directly use the image path
|
| 29 |
+
api_name="/png"
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
|
| 33 |
# Load the foreground image from the returned file path
|
| 34 |
foreground_image_path = result # This contains the path to the processed image
|