Skip to content
Snippets Groups Projects
Commit b9171750 authored by BerendF's avatar BerendF
Browse files

pictures not being sent from api workaround & improvements to training

parent 060f9f1b
No related branches found
No related tags found
No related merge requests found
No preview for this file type
Welcome to my recipe suggestion chatbot:
Made by Berend Fuchs 814080
Why did I choose RASA?
What can this bot do?
Flask
Rasa
Spoonacular API
What are its custom actions and which intents does it classify correctly?
How do I talk with the bot?
How will the bot respond?
\ No newline at end of file
No preview for this file type
......@@ -14,7 +14,7 @@ class ActionRecommendCuisine(Action):
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
cuisines = ["Italian", "Chinese", "Mexican", "Indian", "French", "Japanese", "Thai", "Spanish", "Greek", "Turkish", "Moroccan", "American", "Korean", "Vietnamese", "Ethiopian", "Argentinian", "Lebanese", "German"]
cuisines = ["Italian", "Chinese", "Mexican", "Indian", "French", "Japanese", "Thai", "Spanish", "Greek", "Turkish", "Moroccan", "American", "Korean", "Vietnamese", "Ethiopian", "Argentinian", "Lebanese"]
recommended_cuisine = random.choice(cuisines)
dispatcher.utter_message(text=f"I recommend you try {recommended_cuisine} cuisine!")
......@@ -119,6 +119,11 @@ class ActionShowPicture(Action):
data = response.json()
if data['results']:
image_url = data['results'][0]['image']
test = requests.get(image_url)
if test.status_code == 404:
dispatcher.utter_message("I am unable to fetch this image off of Spoonacular")
dispatcher.utter_message("Can I help you with anything else?")
return "action_"
dispatcher.utter_message(text=f"Here is a picture of {dish}:", image=image_url)
else:
dispatcher.utter_message(text=f"Sorry, I couldn't find a picture for {dish}.")
......
......@@ -117,8 +117,10 @@ nlu:
- How do I make [Green Curry](dish_name)?
- How do I make [Thai-Style Mussels](dish_name)?
- Can you tell me how to prepare [Spaghetti Carbonara](dish_name)?
- What are the steps to make [Chicken Tikka Masala](dish_name)?
- What are the steps to make [Layered Greek Salad](dish_name)?
- What are the steps to make [Chicken Tikka Masala](dish_name)?
- What are the steps to make [Moussaka](dish_name)?
- What are the steps to make [vegetable minestrone soup](dish_name)?
- I want to cook [Beef Wellington](dish_name)
- How to make [Eggs Benedict](dish_name)?
- Can you walk me through making [Pizza](dish_name)?
......@@ -131,6 +133,11 @@ nlu:
- Can you tell me how to cook [Biryani](dish_name)?
- What are the steps for [Enchiladas](dish_name)?
- How to make [Risotto](dish_name)?
- How to make [Plantain Pizza](dish_name)?
- How to make [Lamb Moussaka](dish_name)?
- How to make [Broccolini Quinoa Pilaf](dish_name)?
- How to make [Pork Fried Rice](dish_name)?
- How to make [mango fried rice](dish_name)?
- intent: ask_nutrition_analysis
examples: |
......@@ -316,3 +323,4 @@ nlu:
- Vegetable Minestrone Soup
- vegetable minestrone soup
- Italian Tuna Pasta
- Moussaka
......@@ -9,7 +9,7 @@ stories:
steps:
- intent: ask_capability
- action: utter_capability
- action: utter_capability
- action: utter_capability2
- story: recommend cuisine
steps:
......
......@@ -75,7 +75,8 @@ responses:
- text: "Sounds good! What else do you have planned?"
utter_capability:
- text: I can give you cuisine recommendations.
- text: I know some recipes if you need any guidance!
- text: I could tell you any info that you might need on recipes from Spooncular.
- text: I can give you cuisine and recipe recommendations.
utter_capability2:
- text: I could also tell you any info that you might need on recipes from Spooncular.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment