File size: 812 Bytes
92f9885
 
ec60951
 
 
 
 
 
e74df3c
a39a18a
e74df3c
6e25342
 
 
 
5fcc362
6e25342
 
 
 
eb7f955
6e25342
 
 
 
eb7f955
6e25342
 
5fcc362
6e25342
 
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
30
31
import subprocess
subprocess.run(["pip", "install", "whisper"])
subprocess.run(["pip", "install", "gradio", "--upgrade"])
subprocess.run(["pip", "install", "pip", "--upgrade"])


import gradio as gr


import whisper

def transcribe_audio(audio_file):
    model = whisper.load_model("base")
    result = model.transcribe(audio_file)
    return result["text"]


def main():
    audio_input = gr.inputs.Audio(source="upload", type="filepath")
    output_text = gr.outputs.Textbox()
    
    iface = gr.Interface(fn=transcribe_audio, inputs=audio_input, 
                         outputs=output_text, title="Audio Transcription App",
                         description="Upload an audio file and hit the 'Submit'\
                             button")
    
    iface.launch()


if __name__ == '__main__':
    main()