Spaces:
Sleeping
Sleeping
Stanislav
commited on
Commit
·
4ef3eed
1
Parent(s):
70faf01
feat: fast_api_changes
Browse files- README.md +1 -0
- run_fastapi.py +8 -8
README.md
CHANGED
|
@@ -12,6 +12,7 @@ header: "default"
|
|
| 12 |
short_description: "AI-powered object cutter using Grounding DINO and SAM."
|
| 13 |
models:
|
| 14 |
- "stkrk/sam-vit-b-01ec64"
|
|
|
|
| 15 |
datasets:
|
| 16 |
- "None"
|
| 17 |
tags:
|
|
|
|
| 12 |
short_description: "AI-powered object cutter using Grounding DINO and SAM."
|
| 13 |
models:
|
| 14 |
- "stkrk/sam-vit-b-01ec64"
|
| 15 |
+
- "stkrk/dino_base"
|
| 16 |
datasets:
|
| 17 |
- "None"
|
| 18 |
tags:
|
run_fastapi.py
CHANGED
|
@@ -7,7 +7,6 @@ import shutil
|
|
| 7 |
import os
|
| 8 |
import cv2
|
| 9 |
|
| 10 |
-
|
| 11 |
from pipeline.process_session import process_session_image
|
| 12 |
from database.db import init_db
|
| 13 |
from database.crud import get_session, delete_session
|
|
@@ -16,6 +15,13 @@ from models.dino import DinoWrapper
|
|
| 16 |
|
| 17 |
from huggingface_hub import hf_hub_download
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Check write permissions
|
| 21 |
print("WRITE to ./weights:", os.access("weights", os.W_OK))
|
|
@@ -33,15 +39,9 @@ os.makedirs(WEIGHTS_DIR, exist_ok=True)
|
|
| 33 |
os.makedirs(UPLOADS_DIR, exist_ok=True)
|
| 34 |
os.makedirs(OUTPUTS_DIR, exist_ok=True)
|
| 35 |
|
| 36 |
-
# --- Initialize
|
| 37 |
-
app = FastAPI()
|
| 38 |
init_db()
|
| 39 |
|
| 40 |
-
# --- Mount static files and templates
|
| 41 |
-
app.mount("/outputs", StaticFiles(directory="outputs"), name="outputs") # still serve static from project root
|
| 42 |
-
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 43 |
-
templates = Jinja2Templates(directory="templates")
|
| 44 |
-
|
| 45 |
# === Download and load model SAM checkpoint ===
|
| 46 |
FILENAME = "sam_vit_b_01ec64.pth"
|
| 47 |
REPO_ID = "stkrk/sam-vit-b-checkpoint"
|
|
|
|
| 7 |
import os
|
| 8 |
import cv2
|
| 9 |
|
|
|
|
| 10 |
from pipeline.process_session import process_session_image
|
| 11 |
from database.db import init_db
|
| 12 |
from database.crud import get_session, delete_session
|
|
|
|
| 15 |
|
| 16 |
from huggingface_hub import hf_hub_download
|
| 17 |
|
| 18 |
+
app = FastAPI()
|
| 19 |
+
|
| 20 |
+
# --- Mount static files and templates
|
| 21 |
+
templates = Jinja2Templates(directory="templates")
|
| 22 |
+
app.mount("/outputs", StaticFiles(directory="outputs"), name="outputs") # still serve static from project root
|
| 23 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 24 |
+
|
| 25 |
|
| 26 |
# Check write permissions
|
| 27 |
print("WRITE to ./weights:", os.access("weights", os.W_OK))
|
|
|
|
| 39 |
os.makedirs(UPLOADS_DIR, exist_ok=True)
|
| 40 |
os.makedirs(OUTPUTS_DIR, exist_ok=True)
|
| 41 |
|
| 42 |
+
# --- Initialize database
|
|
|
|
| 43 |
init_db()
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# === Download and load model SAM checkpoint ===
|
| 46 |
FILENAME = "sam_vit_b_01ec64.pth"
|
| 47 |
REPO_ID = "stkrk/sam-vit-b-checkpoint"
|