File size: 771 Bytes
4bdf3be
 
 
 
3513415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8610021
3513415
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import pipeline
import gradio as gr
import os

pipe = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim', use_auth_token=os.environ['HUGGINGFACE_TOKEN'])

def transcribe(audio_mic, audio_file):
    if audio_file is not None:
        return pipe(audio_file)['text']
    if audio_mic is not None:
        return pipe(audio_mic)['text']
    else:
        return 'There was no audio to transcribe...'

iface = gr.Interface(
        fn=transcribe,
        inputs=[gr.Audio(source='microphone', type='filepath'), gr.Audio(source='upload', type='filepath')],
        outputs='text',
        title='Whisper Large v2 - ATCO2-ASR-ATCOSIM',
        description='Whisper Large v2 model fine-tuned on the ATCO2-ASR and ATCOSIM datasets.'
)


iface.launch()