File size: 454 Bytes
113d0af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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