basic program without conversational loop
This commit is contained in:
+4
-1
@@ -49,7 +49,7 @@ def turnOnLED():
|
|||||||
# see if we should execute a certain command based on the current text block
|
# see if we should execute a certain command based on the current text block
|
||||||
def process(text):
|
def process(text):
|
||||||
if "live" in text and "how long" in text:
|
if "live" in text and "how long" in text:
|
||||||
tts.say("")
|
tts.say("Heran")
|
||||||
elif "good morning" in text:
|
elif "good morning" in text:
|
||||||
dt = datetime.now()
|
dt = datetime.now()
|
||||||
dayOfWeek = dt.weekday()
|
dayOfWeek = dt.weekday()
|
||||||
@@ -57,6 +57,8 @@ def process(text):
|
|||||||
tts.say(f"Good morning! Today is {full_month_name} {dt.day}, {dt.year}. The day of the week is {dayOfWeek}")
|
tts.say(f"Good morning! Today is {full_month_name} {dt.day}, {dt.year}. The day of the week is {dayOfWeek}")
|
||||||
|
|
||||||
|
|
||||||
|
tts.say("hello, how can I help you today?")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
while True:
|
while True:
|
||||||
state = GPIO.input(BUTTON)
|
state = GPIO.input(BUTTON)
|
||||||
@@ -74,6 +76,7 @@ if __name__ == '__main__':
|
|||||||
print(response.json())
|
print(response.json())
|
||||||
results = response.json().get("results")
|
results = response.json().get("results")
|
||||||
command = results[0].transcript
|
command = results[0].transcript
|
||||||
|
process(command)
|
||||||
else:
|
else:
|
||||||
if not audioInstance.isRecording():
|
if not audioInstance.isRecording():
|
||||||
turnOnLED()
|
turnOnLED()
|
||||||
|
|||||||
Reference in New Issue
Block a user