File size: 930 Bytes
5bb77aa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b51488
5bb77aa
 
 
 
 
 
6b51488
 
5bb77aa
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# -*- coding: utf-8 -*-
"""whisper_audio_file.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1Drv49mO5QDOUMBpoWeRW6RrxGHLe0b2o

# Using gradio for making a nice UI.
Upload audio file version.

Installing requirements.
"""


from transformers import pipeline
import gradio as gr
import os

"""## Building a Demo"""

pipe = pipeline(model="Victorlopo21/whisper-medium-gl-30")
#pipe = pipeline(model="marvmk/whisper-small-gl")  # change to "your-username/the-name-you-picked"

def transcribe(audio):
    text = pipe(audio)['text']
    return text

iface = gr.Interface(
    fn=transcribe, 
    inputs=gr.Audio(type="filepath"),
    outputs="text",
    title="Whisper File Audio Medium Galician",
    description="Realtime demo for Galician speech recognition with an audio file using a fine-tuned Whisper small model.",
)

iface.launch(debug=True)

# TO TRY