adpro commited on
Commit
fd67b3d
·
verified ·
1 Parent(s): a1a4c08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -11,9 +11,18 @@ import uvicorn
11
 
12
  app = FastAPI()
13
 
14
- # 🟢 Tải hình ZoeDepth-Tiny từ PyTorch Hub
 
 
 
 
 
 
 
 
15
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
16
- model = torch.hub.load("isl-org/ZoeDepth", "ZoeD_NK_T", pretrained=True).to(device) # 🟢 Dùng ZoeDepth-Tiny
 
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/")