File size: 520 Bytes
efe17d8
 
4625491
efe17d8
 
60ad8eb
efe17d8
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import torch, joblib, json
from speechbrain.pretrained import EncoderClassifier
from helper_classes import Config, AudioProcessor, LanguageIdentifier

# Load classifier + config
custom_classifier = joblib.load("custom_classifier.pkl")
label_map = json.load(open("label_map.json"))

config = Config()
config.label_map = label_map

identifier = LanguageIdentifier(config)
identifier.load_vox_model()
identifier.custom_classifier = custom_classifier

def predict(audio_path: str):
    return identifier.predict(audio_path)