Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
import base64
|
| 2 |
from gradio_client import Client
|
| 3 |
-
from transformers import
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
import open3d as o3d
|
| 8 |
from pathlib import Path
|
| 9 |
import os
|
| 10 |
-
import gradio as gr
|
| 11 |
|
| 12 |
# Initialize Gradio client for background removal
|
| 13 |
client = Client("not-lain/background-removal")
|
| 14 |
|
| 15 |
-
# Initialize DPT depth estimation model
|
| 16 |
-
feature_extractor =
|
| 17 |
-
model =
|
| 18 |
|
| 19 |
def process_image(image_path, depth_map_path=None):
|
| 20 |
image_path = Path(image_path)
|
|
|
|
| 1 |
import base64
|
| 2 |
from gradio_client import Client
|
| 3 |
+
from transformers import DPTImageProcessor, DPTForDepthEstimation
|
| 4 |
import torch
|
| 5 |
import numpy as np
|
| 6 |
from PIL import Image
|
| 7 |
import open3d as o3d
|
| 8 |
from pathlib import Path
|
| 9 |
import os
|
| 10 |
+
import gradio as gr
|
| 11 |
|
| 12 |
# Initialize Gradio client for background removal
|
| 13 |
client = Client("not-lain/background-removal")
|
| 14 |
|
| 15 |
+
# Initialize DPT depth estimation model (using the new ImageProcessor)
|
| 16 |
+
feature_extractor = DPTImageProcessor.from_pretrained("Intel/dpt-large")
|
| 17 |
+
model = DPTForDepthEstation.from_pretrained("Intel/dpt-large")
|
| 18 |
|
| 19 |
def process_image(image_path, depth_map_path=None):
|
| 20 |
image_path = Path(image_path)
|