File size: 890 Bytes
9690d29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 time
import timeit

model_tiny = whisper.load_model("tiny.en")
model_base = whisper.load_model("base.en")
model_small = whisper.load_model("small.en")

codes_to_time = ["print(model_tiny.transcribe('2.wav')['text'])",
                 "print(model_base.transcribe('2.wav')['text'])",
                 "print(model_small.transcribe('2.wav')['text'])"]

avg_times = []
for code_to_time in codes_to_time:
    execution_time = timeit.timeit(code_to_time, globals=globals(), number=5)
    avg_time = execution_time / 5.0
    avg_times.append(avg_time)
    print(f"Execution time: {avg_time} seconds")


print(avg_times)
# [1.2609960311994655, 1.8864748299994971, 6.38237024199916]
# From both a speed, and accuracy perspective base is best

# result = model.transcribe("2.wav")
# print(result["text"])

#TODO: Figure out whisper with python chunks to implement into runner