Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ import uvicorn
|
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
15 |
-
# 🟢
|
16 |
zoe_path = "ZoeDepth"
|
17 |
if not os.path.exists(zoe_path):
|
18 |
os.system("git clone https://github.com/isl-org/ZoeDepth.git")
|
@@ -20,9 +20,14 @@ if not os.path.exists(zoe_path):
|
|
20 |
# 🟢 Thêm ZoeDepth vào sys.path để import được
|
21 |
sys.path.append(os.path.abspath(zoe_path))
|
22 |
|
23 |
-
# 🟢
|
24 |
-
|
25 |
-
from zoedepth.
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# 🟢 Load mô hình ZoeDepth-Tiny
|
28 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
15 |
+
# 🟢 Clone ZoeDepth nếu chưa có
|
16 |
zoe_path = "ZoeDepth"
|
17 |
if not os.path.exists(zoe_path):
|
18 |
os.system("git clone https://github.com/isl-org/ZoeDepth.git")
|
|
|
20 |
# 🟢 Thêm ZoeDepth vào sys.path để import được
|
21 |
sys.path.append(os.path.abspath(zoe_path))
|
22 |
|
23 |
+
# 🟢 Cài đặt ZoeDepth (nếu cần)
|
24 |
+
try:
|
25 |
+
from zoedepth.models.builder import build_model
|
26 |
+
from zoedepth.utils.config import get_config
|
27 |
+
except ModuleNotFoundError:
|
28 |
+
os.system("pip install -e ZoeDepth") # 🟢 Cài đặt ZoeDepth trong môi trường runtime
|
29 |
+
from zoedepth.models.builder import build_model
|
30 |
+
from zoedepth.utils.config import get_config
|
31 |
|
32 |
# 🟢 Load mô hình ZoeDepth-Tiny
|
33 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|