lambda_hf_v2 / translations /utils /utils_functions.py
FerdinandPyCode's picture
track files 2
113d0af
raw
history blame
454 Bytes
import speech_recognition as sr
def startConvertion(path = 'ml.wav',lang = 'fr-FR'):
r = sr.Recognizer()
text = ''
with sr.AudioFile(path) as source:
print('Fetching File')
audio_text = r.listen(source)
try:
print('Converting audio transcripts into text ...')
text = r.recognize_google(audio_text, language = lang)
print(text)
except:
pass
return text