sivakorn-su
commited on
Commit
·
3b8d1bc
1
Parent(s):
9c42099
chore: Fix CORS
Browse files
app.py
CHANGED
|
@@ -82,7 +82,7 @@ app = FastAPI()
|
|
| 82 |
|
| 83 |
origins = os.getenv("CORS_ORIGINS", "").split(",")
|
| 84 |
origins = [o.strip() for o in origins if o.strip()] or [
|
| 85 |
-
"
|
| 86 |
]
|
| 87 |
|
| 88 |
app.add_middleware(
|
|
@@ -95,7 +95,12 @@ app.add_middleware(
|
|
| 95 |
|
| 96 |
|
| 97 |
@app.get("/")
|
| 98 |
-
def check_api():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
return {
|
| 100 |
"status": "running",
|
| 101 |
"models_loaded": {
|
|
|
|
| 82 |
|
| 83 |
origins = os.getenv("CORS_ORIGINS", "").split(",")
|
| 84 |
origins = [o.strip() for o in origins if o.strip()] or [
|
| 85 |
+
"*",
|
| 86 |
]
|
| 87 |
|
| 88 |
app.add_middleware(
|
|
|
|
| 95 |
|
| 96 |
|
| 97 |
@app.get("/")
|
| 98 |
+
async def check_api():
|
| 99 |
+
async with model_lock:
|
| 100 |
+
if not pipelines or not models:
|
| 101 |
+
logger.info("🔁 Lazy loading models now...")
|
| 102 |
+
await load_model_bundle()
|
| 103 |
+
|
| 104 |
return {
|
| 105 |
"status": "running",
|
| 106 |
"models_loaded": {
|