From 456b786891e5bf6ab64ae92ad57b7c7eec521398 Mon Sep 17 00:00:00 2001 From: Gaurav Patil <57212399+Gaurav3435@users.noreply.github.com> Date: Fri, 2 Oct 2020 17:19:23 +0530 Subject: [PATCH] Included more comments in main.py Added comments to the main.py for better understanding --- Voice Assistant/src/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Voice Assistant/src/main.py b/Voice Assistant/src/main.py index 9a51fe7..f3ed64d 100644 --- a/Voice Assistant/src/main.py +++ b/Voice Assistant/src/main.py @@ -3,7 +3,7 @@ from gtts import gTTS import speech_recognition as sr - +#function to listen the audio def listen(): # obtain audio from the microphone r = sr.Recognizer() @@ -25,7 +25,7 @@ def listen(): return 'Error' - +#function to say the text def say(text): voice = gTTS(text, lang = "ru") unique_filename = "audio_" + str(random.randint(0, 100000)) + ".mp3" @@ -33,7 +33,7 @@ def say(text): playsound.playsound(unique_filename) print("Assistant:", text) - +#function to handle the message def handle_message(message): message = message.lower() if "привет" in message: @@ -44,7 +44,7 @@ def handle_message(message): say("Я такой команды не знаю") - +#finish function def finish(): print("Пока") exit()