Upload d.py
Browse files
src/d.py
CHANGED
@@ -42,11 +42,14 @@ def debug_audio(audio_path):
|
|
42 |
|
43 |
def get_accent_classifier():
|
44 |
from speechbrain.pretrained.interfaces import foreign_class
|
|
|
|
|
45 |
if not hasattr(get_accent_classifier, "model"):
|
46 |
get_accent_classifier.model = foreign_class(
|
47 |
source="Jzuluaga/accent-id-commonaccent_xlsr-en-english",
|
48 |
pymodule_file="custom_interface.py",
|
49 |
-
classname="CustomEncoderWav2vec2Classifier"
|
|
|
50 |
)
|
51 |
return get_accent_classifier.model
|
52 |
|
|
|
42 |
|
43 |
def get_accent_classifier():
|
44 |
from speechbrain.pretrained.interfaces import foreign_class
|
45 |
+
import os
|
46 |
+
cache_dir = "/tmp/pretrained_models"
|
47 |
if not hasattr(get_accent_classifier, "model"):
|
48 |
get_accent_classifier.model = foreign_class(
|
49 |
source="Jzuluaga/accent-id-commonaccent_xlsr-en-english",
|
50 |
pymodule_file="custom_interface.py",
|
51 |
+
classname="CustomEncoderWav2vec2Classifier",
|
52 |
+
savedir=cache_dir
|
53 |
)
|
54 |
return get_accent_classifier.model
|
55 |
|