Spaces:
Runtime error
Runtime error
Jan van Doorn
commited on
Added some examples
Browse files
app.py
CHANGED
|
@@ -1,11 +1,18 @@
|
|
| 1 |
#%%
|
| 2 |
from huggingface_hub import login
|
| 3 |
from transformers import pipeline
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import os
|
| 6 |
|
| 7 |
login(token=os.environ['hf_token'])
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
## Try to load a local model if available
|
| 10 |
# try:
|
| 11 |
# whisper = pipeline(model='/mnt/projects/whisper/WhisperANSP/Models/whisper-large-v2-atco2-asr-atcosim-ANSP-3h1m', task='automatic-speech-recognition')
|
|
@@ -79,6 +86,7 @@ iface = gr.Interface(
|
|
| 79 |
outputs=[gr.Text(label='Transcription'), gr.Text(label='Callsigns, commands and values')],
|
| 80 |
title='Whisper ATC - Large v3',
|
| 81 |
description='Transcribe and extract',
|
|
|
|
| 82 |
)
|
| 83 |
|
| 84 |
#%%
|
|
|
|
| 1 |
#%%
|
| 2 |
from huggingface_hub import login
|
| 3 |
from transformers import pipeline
|
| 4 |
+
from datasets import load_dataset
|
| 5 |
import gradio as gr
|
| 6 |
import os
|
| 7 |
|
| 8 |
login(token=os.environ['hf_token'])
|
| 9 |
|
| 10 |
+
atco2 = load_dataset('jlvdoorn/atco2', split='validation')
|
| 11 |
+
atcosim = load_dataset('jlvdoorn/atcosim', split='validation')
|
| 12 |
+
|
| 13 |
+
examples = [atco2[0]['audio'], atcosim[0]['audio'], atco2[1]['audio'], atcosim[1]['audio'], atco2[2]['audio'], atcosim[2]['audio']]
|
| 14 |
+
examples_labels = ['Example ' + str(i) for i in len(examples)]
|
| 15 |
+
|
| 16 |
## Try to load a local model if available
|
| 17 |
# try:
|
| 18 |
# whisper = pipeline(model='/mnt/projects/whisper/WhisperANSP/Models/whisper-large-v2-atco2-asr-atcosim-ANSP-3h1m', task='automatic-speech-recognition')
|
|
|
|
| 86 |
outputs=[gr.Text(label='Transcription'), gr.Text(label='Callsigns, commands and values')],
|
| 87 |
title='Whisper ATC - Large v3',
|
| 88 |
description='Transcribe and extract',
|
| 89 |
+
examples = examples,
|
| 90 |
)
|
| 91 |
|
| 92 |
#%%
|