from transformers import pipeline import gradio as gr whisper = pipeline(model='jlvdoorn/whisper-large-v3-atco2-asr-atcosim') def transcribe(audio): if audio is not None: return whisper(audio)['text'] else: return 'There was no audio to transcribe...' file_iface = gr.Interface( fn = transcribe, inputs = gr.Audio(source='upload', interactive=True), outputs = gr.Textbox(label='Transcription'), title = 'Whisper ATC - Large v3', description = 'Transcribe ATC speech', ) mic_iface = gr.Interface( fn = transcribe, inputs = gr.Audio(source='microphone', type='filepath'), outputs = gr.Textbox(label='Transcription'), title = 'Whisper ATC - Large v3', description = 'Transcribe ATC speech', ) demo = gr.TabbedInterface([file_iface, mic_iface], ["File", "Microphone"]) demo.launch(server_name='0.0.0.0')