Update app.py
Browse files
app.py
CHANGED
|
@@ -25,13 +25,13 @@ def process_image(image_path, depth_map_path=None):
|
|
| 25 |
|
| 26 |
# Step 1: Perform background removal
|
| 27 |
result = client.predict(
|
| 28 |
-
|
| 29 |
-
api_name="/
|
| 30 |
)
|
| 31 |
-
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
foreground_image = Image.open(
|
| 35 |
|
| 36 |
if depth_map_path:
|
| 37 |
# Load and resize the user-provided depth map to match the RGB image size
|
|
|
|
| 25 |
|
| 26 |
# Step 1: Perform background removal
|
| 27 |
result = client.predict(
|
| 28 |
+
f=handle_file(image_path), # Use the input image
|
| 29 |
+
api_name="/png" # Ensure the correct API endpoint for PNG output
|
| 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
|
| 34 |
+
foreground_image = Image.open(foreground_image_path) # Open the image
|
| 35 |
|
| 36 |
if depth_map_path:
|
| 37 |
# Load and resize the user-provided depth map to match the RGB image size
|