jlvdoorn commited on
Commit
083757a
1 Parent(s): be31eba

Changed to a single input (audio file)

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -9,11 +9,9 @@ whisper = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim', use_auth
9
  # bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
10
 
11
  #%%
12
- def transcribe(audio_mic, audio_file):
13
  if audio_file is not None:
14
  return whisper(audio_file)['text']
15
- if audio_mic is not None:
16
- return whisper(audio_mic)['text']
17
  else:
18
  return 'There was no audio to transcribe...'
19
 
@@ -48,7 +46,7 @@ def transcribe(audio_mic, audio_file):
48
  #%%
49
  iface = gr.Interface(
50
  fn=transcribe,
51
- inputs=[gr.Audio(source='microphone', type='filepath'), gr.Audio(source='upload', type='filepath')],
52
  outputs=gr.Text(label='Transcription'),
53
  title='Whisper Large v2 - ATCO2-ASR-ATCOSIM',
54
  description='This demo will transcribe ATC audio files by using the Whisper Large v2 model fine-tuned on the ATCO2 and ATCOSIM datasets. Further it uses a Named Entity Recognition model to extract callsigns, commands and values from the transcription. This model is based on Google\'s BERT model and fine-tuned on the ATCO2 dataset.',
 
9
  # bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
10
 
11
  #%%
12
+ def transcribe(audio_file):
13
  if audio_file is not None:
14
  return whisper(audio_file)['text']
 
 
15
  else:
16
  return 'There was no audio to transcribe...'
17
 
 
46
  #%%
47
  iface = gr.Interface(
48
  fn=transcribe,
49
+ inputs=gr.Audio(source='upload', type='filepath'),
50
  outputs=gr.Text(label='Transcription'),
51
  title='Whisper Large v2 - ATCO2-ASR-ATCOSIM',
52
  description='This demo will transcribe ATC audio files by using the Whisper Large v2 model fine-tuned on the ATCO2 and ATCOSIM datasets. Further it uses a Named Entity Recognition model to extract callsigns, commands and values from the transcription. This model is based on Google\'s BERT model and fine-tuned on the ATCO2 dataset.',