import gradio as gr from utils import SpeechRecognition sp = SpeechRecognition() sp.load_model() #sample_file = "assets/samples/sample1378.flac" def recognition(audio_file): print("audio_file", audio_file.name) speech, rate = sp.load_speech_with_file(audio_file.name) result = sp.predict_audio_file(speech) print(result) return result inputs = gr.inputs.Audio(label="Input Audio", type="file") outputs = "text" title = "Turkish Automatic Speech Recognition" description = "Demo for Turkish Automatic Speech Recognition with Huggingface wav2vec Turkish Model. To use it, simply upload your audio, or click one of the examples to load them." article = "

This is the model for patrickvonplaten/wav2vec2-common_voice-tr-demo, a fine-tuned facebook/wav2vec2-large-xlsr-53 model on the Turkish Common Voice dataset.
When using this model, make sure that your speech input is sampled at 16kHz.
Contact me

" examples = [ ['assets/samples/common_voice_sample_1378.flac'], ['assets/samples/common_voice_sample_1589.flac'], ['assets/samples/baris_ozcan_sample_1.wav'], ['assets/samples/baris_ozcan_sample_2.wav'], ['assets/samples/baris_ozcan_sample_3.wav'] ] gr.Interface(recognition, inputs, outputs, title=title, description=description, article=article, examples=examples).launch()