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()