Spaces:
Running
Running
HARSHIT-hash-07 commited on
Commit ·
52e71ec
1
Parent(s): 3b8e923
refactor(backend): safely load fastapi lifecycles and strictly route absolute imports
Browse files- backend/main.py +1 -1
- backend/model_loader.py +2 -2
backend/main.py
CHANGED
|
@@ -2,7 +2,7 @@ from fastapi import FastAPI, HTTPException
|
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from typing import List, Optional
|
| 5 |
-
from
|
| 6 |
|
| 7 |
app = FastAPI(title="SignBridge API", version="1.0.0")
|
| 8 |
|
|
|
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from typing import List, Optional
|
| 5 |
+
from model_loader import SignModel
|
| 6 |
|
| 7 |
app = FastAPI(title="SignBridge API", version="1.0.0")
|
| 8 |
|
backend/model_loader.py
CHANGED
|
@@ -8,7 +8,7 @@ CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
| 8 |
if CURRENT_DIR not in sys.path:
|
| 9 |
sys.path.append(CURRENT_DIR)
|
| 10 |
|
| 11 |
-
from
|
| 12 |
|
| 13 |
# For Hugging Face Spaces / Docker, we'll store weights in a local weights directory
|
| 14 |
MODEL_ROOT = os.path.join(os.path.dirname(CURRENT_DIR), "weights")
|
|
@@ -73,7 +73,7 @@ class SignModel:
|
|
| 73 |
skeletons = self.engine.translate(text, sampling_steps=20)
|
| 74 |
|
| 75 |
import uuid
|
| 76 |
-
from
|
| 77 |
|
| 78 |
filename = f"gen_{uuid.uuid4().hex[:8]}.mp4"
|
| 79 |
output_dir = os.path.join(CURRENT_DIR, "output")
|
|
|
|
| 8 |
if CURRENT_DIR not in sys.path:
|
| 9 |
sys.path.append(CURRENT_DIR)
|
| 10 |
|
| 11 |
+
from sign_bridge_inference import SignBridgeInference
|
| 12 |
|
| 13 |
# For Hugging Face Spaces / Docker, we'll store weights in a local weights directory
|
| 14 |
MODEL_ROOT = os.path.join(os.path.dirname(CURRENT_DIR), "weights")
|
|
|
|
| 73 |
skeletons = self.engine.translate(text, sampling_steps=20)
|
| 74 |
|
| 75 |
import uuid
|
| 76 |
+
from video_renderer import render_skeleton_to_video
|
| 77 |
|
| 78 |
filename = f"gen_{uuid.uuid4().hex[:8]}.mp4"
|
| 79 |
output_dir = os.path.join(CURRENT_DIR, "output")
|