forked from React-Group/interstellar_ai
11 lines
305 B
Python
11 lines
305 B
Python
import speech_recognition as sr
|
|
|
|
|
|
class VoiceRecognition:
|
|
@staticmethod
|
|
def basic_recognition(audio, option):
|
|
r = sr.Recognizer()
|
|
if option == "online":
|
|
return r.recognize_google_cloud(audio)
|
|
if option == "offline":
|
|
return r.recognize_sphinx(audio)
|