Spaces:
Running
Running
Updated app.py to run in HF Spaces
Browse files
app.py
CHANGED
@@ -6,9 +6,15 @@ import os
|
|
6 |
# print(os.environ['hf_token'])
|
7 |
## Try to load a local model if available
|
8 |
try:
|
9 |
-
|
|
|
|
|
|
|
10 |
except:
|
11 |
-
whisper = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim')
|
|
|
|
|
|
|
12 |
bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
|
13 |
|
14 |
#%%
|
@@ -53,8 +59,8 @@ iface = gr.Interface(
|
|
53 |
fn=transcribeAndExtract,
|
54 |
inputs=[gr.Audio(source='upload', type='filepath', interactive=True), gr.Audio(source='microphone', type='filepath'), gr.Checkbox(label='Transcribe only', default=False)],
|
55 |
outputs=[gr.Text(label='Transcription'), gr.Text(label='Callsigns, commands and values')],
|
56 |
-
title=
|
57 |
-
description=
|
58 |
)
|
59 |
|
60 |
#%%
|
|
|
6 |
# print(os.environ['hf_token'])
|
7 |
## Try to load a local model if available
|
8 |
try:
|
9 |
+
whisper = pipeline(model='/mnt/projects/whisper/WhisperANSP/Models/whisper-large-v2-atco2-asr-atcosim-ANSP-3h1m', task='automatic-speech-recognition')
|
10 |
+
ttl = 'Whisper Large v2 - ATCO2-ATCOSIM-ANSP'
|
11 |
+
dis = 'This demo will transcribe ATC audio files by using the Whisper Large v2 model fine-tuned on the ATCO2, ATCOSIM and ANSP datasets. \n \n Further it uses a Named Entity Recognition model to extract callsigns, commands and values from the transcription. \n This model is based on Google\'s BERT model and fine-tuned on the ATCO2 dataset.'
|
12 |
+
|
13 |
except:
|
14 |
+
whisper = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim', use_auth_token=os.environ['hf_token'], task='automatic-speech-recognition')
|
15 |
+
ttl = 'Whisper Large v2 - ATCO2-ATCOSIM'
|
16 |
+
dis = 'This demo will transcribe ATC audio files by using the Whisper Large v2 model fine-tuned on the ATCO2 and ATCOSIM datasets. \n \n Further it uses a Named Entity Recognition model to extract callsigns, commands and values from the transcription. \n This model is based on Google\'s BERT model and fine-tuned on the ATCO2 dataset.'
|
17 |
+
|
18 |
bert_atco_ner = pipeline(model='Jzuluaga/bert-base-ner-atc-en-atco2-1h')
|
19 |
|
20 |
#%%
|
|
|
59 |
fn=transcribeAndExtract,
|
60 |
inputs=[gr.Audio(source='upload', type='filepath', interactive=True), gr.Audio(source='microphone', type='filepath'), gr.Checkbox(label='Transcribe only', default=False)],
|
61 |
outputs=[gr.Text(label='Transcription'), gr.Text(label='Callsigns, commands and values')],
|
62 |
+
title=ttl,
|
63 |
+
description=dis,
|
64 |
)
|
65 |
|
66 |
#%%
|