Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from transformers import pipeline | |
| from transformers import AutoTokenizer | |
| # Create a PretrainedTokenizer object | |
| tokenizer = AutoTokenizer.from_pretrained('wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut') | |
| # Pass the PretrainedTokenizer object as the tokenizer argument | |
| p = pipeline('text-generation', model='wannaphong/wav2vec2-large-xlsr-53-th-cv8-deepcut', tokenizer=tokenizer) | |
| def transcribe(audio): | |
| # Pass the audio file to the pipeline and obtain the output | |
| text = p(audio)["generated_text"] | |
| return text | |
| # Create a GraudioInput object for the audio input | |
| audio_input = gr.Audio(source="microphone", type="filepath") | |
| # Use the GraudioInput object as the value for the inputs argument | |
| gr.Interface( | |
| fn=transcribe, | |
| inputs=audio_input, | |
| outputs="text").launch() | |