Spaces:
Runtime error
Runtime error
File size: 1,598 Bytes
8c25af7 |
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 26 27 28 29 30 31 32 33 34 |
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 = "<p style='text-align: center'>This is the model for <a href='https://huggingface.co/m3hrdadfi/wav2vec2-large-xlsr-turkish' target='_blank'>m3hrdadfi/wav2vec2-large-xlsr-turkish</a>, a fine-tuned <a href='https://huggingface.co/facebook/wav2vec2-large-xlsr-53' target='_blank'>facebook/wav2vec2-large-xlsr-53</a> model on the <a href='https://commonvoice.mozilla.org/en/datasets' target='_blank'>Turkish Common Voice dataset</a>.<br/>When using this model, make sure that your speech input is sampled at 16kHz.</a></p>"
examples = [
['assets/samples/common_voice_sample_1378.flac'],
['assets/samples/common_voice_sample_1589.flac'],
['assets/samples/baris_ozcan_sample_1.m4a'],
['assets/samples/baris_ozcan_sample_2.wav'],
['assets/samples/baris_ozcan_sample_3.m4a']
]
gr.Interface(recognition, inputs, outputs, title=title, description=description, article=article, examples=examples).launch() |