lấy một file audio rồi dịch thành chữ
import speech_recognition as sr def speech_to_text(path): r = sr.Recognizer() with sr.AudioFile(path) as source: audio = r.record(source) try: return r.recognize_google(audio) except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print("Could not request results from Google Speech Recognition service; {0}".format(e))