benkada commited on
Commit
57d09d7
·
verified ·
1 Parent(s): 7c40d04

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -2
main.py CHANGED
@@ -29,8 +29,11 @@ app.add_middleware(
29
  allow_headers=["*"],
30
  )
31
 
32
- # Serve optional static assets (e.g., /static/logo.png)
33
- app.mount("/static", StaticFiles(directory="static"), name="static")
 
 
 
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)