-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
whs.py
29 lines (22 loc) · 790 Bytes
/
whs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import whisper
import configparser
def get_model_options():
models = whisper.available_models()
print('Available models: ', ''.join(models))
def load_model():
# Selected and load from the list of available models that can fit in your system
# Initialize ConfigParser
config = configparser.ConfigParser()
# Read settings.ini file
config.read('settings.ini')
# Get values
whisper_model = config.get('Local Wisper Settings', 'whisper_model')
# Load the model
print(f'Loading the {whisper_model} model...')
model = whisper.load_model(whisper_model)
print('Model loaded')
return model
def test_whisper(file='audio_chunk.wav'):
model = load_model()
transcription = model.transcribe(file)
print(transcription['text'])