File size: 806 Bytes
4d57eee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import argparse

def main(args):
    audio_file = args.input
    language = args.language
    output_folder = "transcriptions"

    # Transcribe audio file
    model = "large-v2"
    word_timestamps = True
    fp16 = False
    device = "cuda"
    verbose = False
    threads = 4
    command = f'whisper --model {model} --output_dir {output_folder} --language {language} \
--word_timestamps {word_timestamps} --fp16 {fp16} --device {device} --verbose {verbose} \
--threads {threads} {audio_file}'
    os.system(command)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Transcribe audio files')
    parser.add_argument('input', help='Input audio file')
    parser.add_argument('language', help='Language of the audio file')
    args = parser.parse_args()
    main(args)