Update app.py
Browse files
app.py
CHANGED
@@ -11,9 +11,18 @@ import uvicorn
|
|
11 |
|
12 |
app = FastAPI()
|
13 |
|
14 |
-
# 🟢
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
16 |
-
|
|
|
17 |
model.eval()
|
18 |
|
19 |
@app.post("/analyze_path/")
|
|
|
11 |
|
12 |
app = FastAPI()
|
13 |
|
14 |
+
# 🟢 Cài đặt ZoeDepth từ Hugging Face (chạy trên lần đầu)
|
15 |
+
if not os.path.exists("ZoeDepth"):
|
16 |
+
os.system("git clone https://github.com/isl-org/ZoeDepth.git")
|
17 |
+
|
18 |
+
# 🟢 Import ZoeDepth sau khi clone
|
19 |
+
from ZoeDepth.zoedepth.models.builder import build_model
|
20 |
+
from ZoeDepth.zoedepth.utils.config import get_config
|
21 |
+
|
22 |
+
# 🟢 Load mô hình ZoeDepth-Tiny
|
23 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
24 |
+
config = get_config("ZoeDepth/configs/zoedepth_tiny.py") # 🟢 Chọn model tiny để chạy nhanh hơn
|
25 |
+
model = build_model(config).to(device)
|
26 |
model.eval()
|
27 |
|
28 |
@app.post("/analyze_path/")
|