python中的语音识别响应太慢
在运行下面的代码后,打印我所说的作为输入的语句需要3分钟以上python中的语音识别响应太慢,python,python-3.x,speech-recognition,Python,Python 3.x,Speech Recognition,在运行下面的代码后,打印我所说的作为输入的语句需要3分钟以上 import pyttsx3 import datetime import speech_recognition as sr r=sr.Recognizer() with sr.Microphone() as source: audio=r.listen(source) try: print("You said:"+r.recognize_google(audio)) except Exception: print("repeat a
import pyttsx3
import datetime
import speech_recognition as sr
r=sr.Recognizer()
with sr.Microphone() as source:
audio=r.listen(source)
try:
print("You said:"+r.recognize_google(audio))
except Exception:
print("repeat again")
它可能是你的互联网连接或麦克风,我在一个有语音识别的项目中工作,但响应有时需要10秒多一点这是我的例子,我用了一个树莓
import speech_recognition as sr
#import robby
r = sr.Recognizer()
def inicio():
with sr.Microphone() as source:
print("Di algo:")
audio = r.listen(source)
funciones(audio)
def funciones(audio):
try:
print("Dijiste " + r.recognize_google(audio))
if r.recognize_google(audio)=='hello':
print('hello ')
#robby.arranca()
#inicio()
elif r.recognize_google(audio)=='stop':
robby.stop()
except sr.UnknownValueError:
print("Could not understand audio")
except sr.RequestError as e:
print("Could not request results; {0}".format(e))
inicio()
你的问题是什么?我的网络很好,麦克风在工作,为什么花的时间太长?请缩进你的代码。先生,我不知道什么是错误,它没有显示任何错误。我有8gb内存和4gb显卡,这是因为硬件要求吗?我的网络很好,麦克风工作正常,为什么花的时间太长?