File size: 770 Bytes
d079ec5
 
 
 
e188a2d
 
d079ec5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

from transformers import pipeline

#MODEL_NAME="ctaguchi/wav2vec2-large-xlsr-japlmthufielta-ipa1000-ns"
MODEL_NAME="ginic/wav2vec-large-xlsr-en-ipa"

pipe = pipeline(task="automatic-speech-recognition", model=MODEL_NAME)

def predict(audio_in):
    return pipe(audio_in)["text"]


def launch_demo():
    with gr.Blocks() as demo:
        gr.Markdown(f"""
        # Automatic International Phonetic Alphabet Transcription
        This demo allows you to experiment with producing phonetic transcriptions of uploaded or recorded audio using the model '{MODEL_NAME}'.
        """)
        gr.Interface(fn=predict, inputs=gr.Audio(type="filepath"), outputs="text", allow_flagging="never")

    demo.launch()

if __name__ == "__main__":
    launch_demo()