Upload 2 files
Browse files- src/d.py +5 -0
- src/streamlit_app.py +7 -1
src/d.py
CHANGED
|
@@ -46,6 +46,11 @@ def debug_audio(audio_path):
|
|
| 46 |
def get_accent_classifier():
|
| 47 |
from speechbrain.pretrained.interfaces import foreign_class
|
| 48 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
# Set all relevant cache dirs to /tmp to avoid permission errors
|
| 50 |
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 51 |
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface/hub"
|
|
|
|
| 46 |
def get_accent_classifier():
|
| 47 |
from speechbrain.pretrained.interfaces import foreign_class
|
| 48 |
import os
|
| 49 |
+
import shutil
|
| 50 |
+
# Remove any local folders that may cause permission errors
|
| 51 |
+
for folder in ["pretrained_models", "wav2vec2_checkpoints"]:
|
| 52 |
+
if os.path.exists(folder):
|
| 53 |
+
shutil.rmtree(folder)
|
| 54 |
# Set all relevant cache dirs to /tmp to avoid permission errors
|
| 55 |
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 56 |
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface/hub"
|
src/streamlit_app.py
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from d import download_and_extract_audio, analyze_accent, get_accent_classifier
|
| 4 |
|
| 5 |
st.title("English Accent Classifier")
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
| 3 |
+
os.environ["HF_HUB_CACHE"] = "/tmp/huggingface/hub"
|
| 4 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface/transformers"
|
| 5 |
+
os.environ["TORCH_HOME"] = "/tmp/torch"
|
| 6 |
+
os.environ["XDG_CACHE_HOME"] = "/tmp/xdg_cache"
|
| 7 |
+
|
| 8 |
+
import streamlit as st
|
| 9 |
from d import download_and_extract_audio, analyze_accent, get_accent_classifier
|
| 10 |
|
| 11 |
st.title("English Accent Classifier")
|