File size: 324 Bytes
873d0cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
model_ = None


def model():
    global model_
    if model_ is None:
        import whisper

        model_ = whisper.load_model("tiny")
    return model_


def preload_stt_openai_whisper_local():
    model()


def stt_openai_whisper_local(audio_file):
    result = model().transcribe(audio_file)
    return result["text"]