Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,17 @@ import soundfile as sf
|
|
5 |
import numpy as np
|
6 |
from scipy import signal
|
7 |
import os
|
|
|
8 |
|
9 |
# Set the cache directory to a writable location
|
10 |
-
|
11 |
-
os.environ["
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Load the Whisper model and processor directly from Hugging Face
|
14 |
def load_model():
|
|
|
5 |
import numpy as np
|
6 |
from scipy import signal
|
7 |
import os
|
8 |
+
import shutil
|
9 |
|
10 |
# Set the cache directory to a writable location
|
11 |
+
cache_dir = "/tmp/.cache"
|
12 |
+
os.environ["TRANSFORMERS_CACHE"] = cache_dir
|
13 |
+
os.environ["HF_DATASETS_CACHE"] = cache_dir
|
14 |
+
|
15 |
+
# Clear the cache directory to avoid corruption issues
|
16 |
+
if os.path.exists(cache_dir):
|
17 |
+
shutil.rmtree(cache_dir)
|
18 |
+
os.makedirs(cache_dir, exist_ok=True)
|
19 |
|
20 |
# Load the Whisper model and processor directly from Hugging Face
|
21 |
def load_model():
|