with slot example
This commit is contained in:
parent
5e57d6d9b7
commit
517db5be29
|
|
@ -12,11 +12,11 @@ logging.getLogger('flask_ask').setLevel(logging.DEBUG)
|
|||
|
||||
@ask.launch
|
||||
def launch():
|
||||
return question("This will take about 5 minutes. Are you Ready?")
|
||||
return question("Each excercise will take about 5 minutes. Are you Ready?")
|
||||
|
||||
|
||||
def get_workoutplan():
|
||||
with open("workouts.yaml", 'r') as stream:
|
||||
with open("C:/Users/John/Desktop/GST/samples/reddit/workouts.yaml", 'r') as stream:
|
||||
exercises = yaml.load(stream)
|
||||
exercise_names = random.sample(list(exercises), 5)
|
||||
workout_plan = []
|
||||
|
|
@ -26,14 +26,17 @@ def get_workoutplan():
|
|||
return workout_plan
|
||||
|
||||
|
||||
@ask.intent('YesIntent')
|
||||
def start_workout():
|
||||
@ask.intent('YesIntent', mapping={'part': 'Part'})
|
||||
def start_workout(part):
|
||||
print(part)
|
||||
workout_plan = get_workoutplan()
|
||||
response = ""
|
||||
response = "Do "
|
||||
|
||||
for excercise in workout_plan[:-1]:
|
||||
response += excercise + ", "
|
||||
response += " and " + workout_plan[-1]
|
||||
return statement(workout_plan)
|
||||
print(response)
|
||||
return statement(response)
|
||||
|
||||
@ask.intent('NoIntent')
|
||||
def no():
|
||||
|
|
@ -44,6 +47,7 @@ def help():
|
|||
speech_text = 'If you want a quick workout just say "workout"'
|
||||
return statement(speech_text)
|
||||
|
||||
|
||||
@ask.session_ended
|
||||
def session_ended():
|
||||
return "{}", 200
|
||||
|
|
@ -54,4 +58,4 @@ if __name__ == '__main__':
|
|||
verify = str(os.environ.get('ASK_VERIFY_REQUESTS', '')).lower()
|
||||
if verify == 'false':
|
||||
app.config['ASK_VERIFY_REQUESTS'] = False
|
||||
app.run(debug=True)
|
||||
app.run()
|
||||
|
|
@ -1,10 +1,50 @@
|
|||
|
||||
{
|
||||
"intents": [
|
||||
{
|
||||
"intent": "HelloWorldIntent"
|
||||
},
|
||||
{
|
||||
"intent": "AMAZON.HelpIntent"
|
||||
}
|
||||
]
|
||||
}
|
||||
"interactionModel": {
|
||||
"languageModel": {
|
||||
"invocationName": "give me a workout",
|
||||
"intents": [
|
||||
{
|
||||
"name": "AMAZON.CancelIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "AMAZON.HelpIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "AMAZON.StopIntent",
|
||||
"samples": []
|
||||
},
|
||||
{
|
||||
"name": "YesIntent",
|
||||
"slots": [],
|
||||
"samples": [
|
||||
"yes"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "NoIntent",
|
||||
"slots": [],
|
||||
"samples": [
|
||||
"no"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "HelloWorldIntent",
|
||||
"slots": [],
|
||||
"samples": [
|
||||
"let's workout",
|
||||
"give me todays workout",
|
||||
"what's todays workout"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "AMAZON.NavigateHomeIntent",
|
||||
"samples": []
|
||||
}
|
||||
],
|
||||
"types": []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
Chest
|
||||
Legs
|
||||
Torso
|
||||
Upper body
|
||||
Loading…
Reference in New Issue