Update main.py
Browse files
main.py
CHANGED
|
@@ -29,8 +29,11 @@ app.add_middleware(
|
|
| 29 |
allow_headers=["*"],
|
| 30 |
)
|
| 31 |
|
| 32 |
-
# Serve optional static assets
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# -----------------------------------------------------------------------------
|
| 36 |
# MODEL CLIENTS (remote Hugging Face Inference API)
|
|
|
|
| 29 |
allow_headers=["*"],
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# Serve optional static assets **only if the folder exists**
|
| 33 |
+
from pathlib import Path
|
| 34 |
+
static_dir = Path("static")
|
| 35 |
+
if static_dir.exists():
|
| 36 |
+
app.mount("/static", StaticFiles(directory="static"), name="static"), name="static")
|
| 37 |
|
| 38 |
# -----------------------------------------------------------------------------
|
| 39 |
# MODEL CLIENTS (remote Hugging Face Inference API)
|