Spaces:
Running
Running
Interface added
Browse files
app.py
CHANGED
@@ -2,4 +2,22 @@ from transformers import pipeline
|
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
|
5 |
-
pipe = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim', use_auth_token=os.environ['HUGGINGFACE_TOKEN'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import gradio as gr
|
3 |
import os
|
4 |
|
5 |
+
pipe = pipeline(model='jlvdoorn/whisper-large-v2-atco2-asr-atcosim', use_auth_token=os.environ['HUGGINGFACE_TOKEN'])
|
6 |
+
|
7 |
+
def transcribe(audio_mic, audio_file):
|
8 |
+
if audio_file is not None:
|
9 |
+
return pipe(audio_file)['text']
|
10 |
+
if audio_mic is not None:
|
11 |
+
return pipe(audio_mic)['text']
|
12 |
+
else:
|
13 |
+
return 'There was no audio to transcribe...'
|
14 |
+
|
15 |
+
iface = gr.Interface(
|
16 |
+
fn=transcribe,
|
17 |
+
inputs=[gr.Audio(source='microphone', type='filepath'), gr.Audio(source='upload', type='filepath')],
|
18 |
+
outputs='text',
|
19 |
+
title='Whisper Large v2 - ATCO2-ASR-ATCOSIM',
|
20 |
+
description='Whisper Large v2 model fine-tuned on the ATCO2-ASR and ATCOSIM datasets.'
|
21 |
+
)
|
22 |
+
|
23 |
+
iface.launch()
|