Spaces:
Running
Running
Commit
·
ac9145f
1
Parent(s):
9760eda
Refactor main.py to disable JIT and remove unused import, and patch librosa to remove Numba dependency and replace Numba-dependent functions with pure Python counterparts
Browse files- app/main.py +3 -2
- app/patch_librosa.py +11 -0
app/main.py
CHANGED
@@ -6,8 +6,9 @@ from app.core.logging_config import configure_logging
|
|
6 |
from app.core.firebase_config import initialize_firebase
|
7 |
from app.api.forgery_routes import router as forgery_router
|
8 |
import logging
|
9 |
-
import
|
10 |
-
|
|
|
11 |
|
12 |
app = FastAPI()
|
13 |
|
|
|
6 |
from app.core.firebase_config import initialize_firebase
|
7 |
from app.api.forgery_routes import router as forgery_router
|
8 |
import logging
|
9 |
+
import os
|
10 |
+
os.environ['NUMBA_DISABLE_JIT'] = '1'
|
11 |
+
import patch_librosa
|
12 |
|
13 |
app = FastAPI()
|
14 |
|
app/patch_librosa.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import librosa
|
2 |
+
|
3 |
+
# Remove Numba dependency
|
4 |
+
librosa.util.utils.__dict__['numba'] = None
|
5 |
+
|
6 |
+
# Replace Numba-dependent functions with their pure Python counterparts
|
7 |
+
librosa.util.utils.__dict__['pitch_tuning'] = librosa.util.utils.__dict__['__pitch_tuning']
|
8 |
+
librosa.util.utils.__dict__['tiny'] = librosa.util.utils.__dict__['__tiny']
|
9 |
+
librosa.util.utils.__dict__['normalize'] = librosa.util.utils.__dict__['__normalize']
|
10 |
+
librosa.util.utils.__dict__['localmax'] = librosa.util.utils.__dict__['__localmax']
|
11 |
+
librosa.util.utils.__dict__['peak_pick'] = librosa.util.utils.__dict__['__peak_pick']
|