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