Spaces:
Running
Running
SantosPatazca
commited on
Commit
·
da65aa1
1
Parent(s):
f57c249
fix(audio): configurar NUMBA/LIBROSA cache dirs para upload en HF Spaces
Browse files
main.py
CHANGED
@@ -1,6 +1,16 @@
|
|
1 |
-
import sys, os, time
|
2 |
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "src")))
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
from fastapi import FastAPI
|
5 |
from fastapi.middleware.cors import CORSMiddleware
|
6 |
from fastapi.responses import HTMLResponse
|
|
|
1 |
+
import sys, os, time, pathlib
|
2 |
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "src")))
|
3 |
|
4 |
+
# --- Fix: cache de Numba/Librosa en /tmp para entornos readonly (HF Spaces) ---
|
5 |
+
os.environ.setdefault("NUMBA_CACHE_DIR", "/tmp/numba_cache")
|
6 |
+
os.environ.setdefault("LIBROSA_CACHE_DIR", "/tmp/librosa_cache")
|
7 |
+
# Si persiste el error, descomenta esta línea para desactivar caché:
|
8 |
+
# os.environ["NUMBA_DISABLE_CACHING"] = "1"
|
9 |
+
|
10 |
+
pathlib.Path(os.environ["NUMBA_CACHE_DIR"]).mkdir(parents=True, exist_ok=True)
|
11 |
+
pathlib.Path(os.environ["LIBROSA_CACHE_DIR"]).mkdir(parents=True, exist_ok=True)
|
12 |
+
# -------------------------------------------------------------------------------
|
13 |
+
|
14 |
from fastapi import FastAPI
|
15 |
from fastapi.middleware.cors import CORSMiddleware
|
16 |
from fastapi.responses import HTMLResponse
|