Spaces:
Running
Running
Jan van Doorn
commited on
Refactor audio input and output
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ examples = examples_atco2 #+ examples_atcosim
|
|
13 |
|
14 |
whisper = pipeline(model='jlvdoorn/whisper-large-v3-atco2-asr-atcosim')
|
15 |
|
16 |
-
def transcribe(audio
|
17 |
if audio is not None:
|
18 |
return whisper(audio)['text']
|
19 |
else:
|
@@ -21,12 +21,9 @@ def transcribe(audio, model_version):
|
|
21 |
|
22 |
file_iface = gr.Interface(
|
23 |
fn = transcribe,
|
24 |
-
inputs =
|
25 |
-
gr.Checkbox(label='Transcribe only', default=False),
|
26 |
-
gr.Dropdown(choices=['large-v2', 'large-v3'], value='large-v3', label='Whisper model version')
|
27 |
-
],
|
28 |
|
29 |
-
outputs =
|
30 |
title = 'Whisper ATC - Large v3',
|
31 |
description = 'Transcribe ATC speech',
|
32 |
# examples = examples,
|
@@ -34,12 +31,9 @@ file_iface = gr.Interface(
|
|
34 |
|
35 |
mic_iface = gr.Interface(
|
36 |
fn = transcribe,
|
37 |
-
inputs =
|
38 |
-
gr.Checkbox(label='Transcribe only', default=False),
|
39 |
-
gr.Dropdown(choices=['large-v2', 'large-v3'], value='large-v3', label='Whisper model version')
|
40 |
-
],
|
41 |
|
42 |
-
outputs =
|
43 |
title = 'Whisper ATC - Large v3',
|
44 |
description = 'Transcribe ATC speech',
|
45 |
)
|
|
|
13 |
|
14 |
whisper = pipeline(model='jlvdoorn/whisper-large-v3-atco2-asr-atcosim')
|
15 |
|
16 |
+
def transcribe(audio):
|
17 |
if audio is not None:
|
18 |
return whisper(audio)['text']
|
19 |
else:
|
|
|
21 |
|
22 |
file_iface = gr.Interface(
|
23 |
fn = transcribe,
|
24 |
+
inputs = gr.Audio(source='upload', interactive=True),
|
|
|
|
|
|
|
25 |
|
26 |
+
outputs = gr.Textbox(label='Transcription'),
|
27 |
title = 'Whisper ATC - Large v3',
|
28 |
description = 'Transcribe ATC speech',
|
29 |
# examples = examples,
|
|
|
31 |
|
32 |
mic_iface = gr.Interface(
|
33 |
fn = transcribe,
|
34 |
+
inputs = gr.Audio(source='microphone', type='filepath'),
|
|
|
|
|
|
|
35 |
|
36 |
+
outputs = gr.Textbox(label='Transcription'),
|
37 |
title = 'Whisper ATC - Large v3',
|
38 |
description = 'Transcribe ATC speech',
|
39 |
)
|