File size: 606 Bytes
8c4c651
3a8fa93
 
 
 
8d13e33
3a8fa93
 
 
 
 
 
 
e2a53fa
3a8fa93
 
 
6f5a01e
910abef
 
 
 
 
 
eac1a4c
3a8fa93
 
dc56755
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

import gradio as gr
from transformers import pipeline
import numpy as np

title = "Frisian Automatic Speech Recognition"
transcriber = pipeline("automatic-speech-recognition", model="Reihaneh/wav2vec2_frisian_common_voice_1")

def transcribe(audio):
    sr, y = audio
    y = y.astype(np.float32)
    y /= np.max(np.abs(y))

    return transcriber({"sampling_rate": sr, "raw": y})["text"]


demo = gr.Interface(
    
    transcribe,
    gr.Audio(sources=["upload"]),
    "text",
    #fn=transcribe,
    #inputs=gr.Audio(sources=["upload"]),
    #outputs="text",
    title=title,
)

demo.launch(debug=True)