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
|
@ask.launch
|
||||||
def 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():
|
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)
|
exercises = yaml.load(stream)
|
||||||
exercise_names = random.sample(list(exercises), 5)
|
exercise_names = random.sample(list(exercises), 5)
|
||||||
workout_plan = []
|
workout_plan = []
|
||||||
|
|
@ -26,14 +26,17 @@ def get_workoutplan():
|
||||||
return workout_plan
|
return workout_plan
|
||||||
|
|
||||||
|
|
||||||
@ask.intent('YesIntent')
|
@ask.intent('YesIntent', mapping={'part': 'Part'})
|
||||||
def start_workout():
|
def start_workout(part):
|
||||||
|
print(part)
|
||||||
workout_plan = get_workoutplan()
|
workout_plan = get_workoutplan()
|
||||||
response = ""
|
response = "Do "
|
||||||
|
|
||||||
for excercise in workout_plan[:-1]:
|
for excercise in workout_plan[:-1]:
|
||||||
response += excercise + ", "
|
response += excercise + ", "
|
||||||
response += " and " + workout_plan[-1]
|
response += " and " + workout_plan[-1]
|
||||||
return statement(workout_plan)
|
print(response)
|
||||||
|
return statement(response)
|
||||||
|
|
||||||
@ask.intent('NoIntent')
|
@ask.intent('NoIntent')
|
||||||
def no():
|
def no():
|
||||||
|
|
@ -44,6 +47,7 @@ def help():
|
||||||
speech_text = 'If you want a quick workout just say "workout"'
|
speech_text = 'If you want a quick workout just say "workout"'
|
||||||
return statement(speech_text)
|
return statement(speech_text)
|
||||||
|
|
||||||
|
|
||||||
@ask.session_ended
|
@ask.session_ended
|
||||||
def session_ended():
|
def session_ended():
|
||||||
return "{}", 200
|
return "{}", 200
|
||||||
|
|
@ -54,4 +58,4 @@ if __name__ == '__main__':
|
||||||
verify = str(os.environ.get('ASK_VERIFY_REQUESTS', '')).lower()
|
verify = str(os.environ.get('ASK_VERIFY_REQUESTS', '')).lower()
|
||||||
if verify == 'false':
|
if verify == 'false':
|
||||||
app.config['ASK_VERIFY_REQUESTS'] = False
|
app.config['ASK_VERIFY_REQUESTS'] = False
|
||||||
app.run(debug=True)
|
app.run()
|
||||||
|
|
@ -1,10 +1,50 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"intents": [
|
"interactionModel": {
|
||||||
{
|
"languageModel": {
|
||||||
"intent": "HelloWorldIntent"
|
"invocationName": "give me a workout",
|
||||||
},
|
"intents": [
|
||||||
{
|
{
|
||||||
"intent": "AMAZON.HelpIntent"
|
"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