Spaces:
Build error
Build error
| # -*- coding: utf-8 -*- | |
| """GradioASRdemo.ipynb | |
| Automatically generated by Colab. | |
| Original file is located at | |
| https://colab.research.google.com/drive/1OgSEOxvR1jUIG-aE0dQHXpr9-ODs63Ll | |
| """ | |
| import gradio as gr | |
| from transformers import AutoFeatureExtractor, AutoModelForSeq2SeqLM, AutoTokenizer, pipeline | |
| model_name1 = "openai/whisper-tiny" | |
| feature_extractor = AutoFeatureExtractor.from_pretrained(model_name1) | |
| sampling_rate = feature_extractor.sampling_rate | |
| asr = pipeline("automatic-speech-recognition", model=model_name1) | |
| def speech_to_text(input_file): | |
| transcribed_text = asr(input_file, chunk_length_s=30) #, chunk_length_s=30 | |
| return transcribed_text["text"] | |
| #inputs=gr.Audio(source="upload", type="filepath", label="Upload your audio") | |
| inputs=gr.Audio(sources="upload", type="filepath", label="Upload Kannada audio file") | |
| # outputs=gr.Textbox() | |
| # examples = [["test1.wav"], ["test2.wav"]] | |
| description = "Demo for Kannada ASR model " | |
| gr.Interface( | |
| speech_to_text, | |
| inputs = inputs, | |
| outputs = "text", | |
| title="Kannada ASR model", | |
| ).launch() |