From db3ee32cea16e6863965fb59e4987afc2791cf6c Mon Sep 17 00:00:00 2001 From: anhlt Date: Fri, 3 Feb 2023 02:13:37 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'mss.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add comment --- mss.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mss.py b/mss.py index 19d860b..980b453 100644 --- a/mss.py +++ b/mss.py @@ -39,13 +39,13 @@ def on_message(client, userdata, msg): def publish(client): global msg while True: - robot_ear = speech_recognition.Recognizer() - with speech_recognition.Microphone() as mic: + robot_ear = speech_recognition.Recognizer() # khởi tạo biến bien robot_ear + with speech_recognition.Microphone() as mic: # khởi tạo biến mic (with giúp dừng thu tiếng) print("robot : im listen") - audio = robot_ear.listen(mic) + audio = robot_ear.listen(mic) # khởi tạo biến audio = dl nghe được từ mic try: - msg = robot_ear.recognize_google(audio) + msg = robot_ear.recognize_google(audio) # chuyển dl nghe đc sang dạng text except: msg = ""