AashishKumar commited on
Commit
e22b879
·
1 Parent(s): fe247ad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -12,7 +12,7 @@ restaurants = {
12
  "Diet Coke": 2.99,
13
  "Chocolate Chip Cookie": 2.99
14
  },
15
- "Fry Nation": {
16
  "Whopper Meal": 7.99,
17
  "Chicken Fries": 3.99,
18
  "Impossible Whopper": 5.99,
@@ -30,7 +30,7 @@ restaurants = {
30
  "Baja Blast Freeze": 2.49,
31
  "Cinnamon Twists": 1.99
32
  },
33
- "Mr McDonald's": {
34
  "Big Mac-Meal": 6.49,
35
  "10-Piece Chicken-McNuggets": 4.29,
36
  "Filet Fish": 3.79,
@@ -112,6 +112,7 @@ def main(audio):
112
  txt_extract = "extract the restaurants name keyword from the sentence :\n\n"+command
113
  restaurant_name = " ".join(((nlp(txt_extract)).strip()).title().split()[-2:])
114
  found_rest = False
 
115
  if(restaurant_name in restaurants.keys()):
116
  found_rest = True
117
 
@@ -119,9 +120,11 @@ def main(audio):
119
  txt_extract = "extract the food item from the sentence :\n\n"+command
120
  item_name = " ".join(((nlp(txt_extract)).strip()).title().strip(".,;:").split()[-2:])
121
  found_item = False
 
122
  for restaurant, rest_info in restaurants.items():
123
  if item_name in rest_info:
124
  found_item = True
 
125
 
126
  print(found_item , found_rest)
127
  if food_command in ['order', 'eat' , 'want' , 'serve' , 'prepare' ]:
@@ -134,6 +137,7 @@ def main(audio):
134
  min_price = min(temp_val.values())
135
  res = [key for key in temp_val if temp_val[key] == min_price]
136
  response = f"You have ordered {item_name} from {res[0]} with price of {min_price}"
 
137
 
138
  elif found_rest and found_item:
139
  response = f"\nYou ordered {item_name} from {restaurant_name}\nGreat! Thank you for ordering."
@@ -164,6 +168,7 @@ def main(audio):
164
 
165
  elif food_command in ['menu' , 'menus' , 'catalogue' , 'items' , 'something']:
166
  if found_rest:
 
167
  for restaurant_name in restaurants:
168
  if restaurant in command:
169
  menu_items = get_menu_items(restaurant)
 
12
  "Diet Coke": 2.99,
13
  "Chocolate Chip Cookie": 2.99
14
  },
15
+ "Bamboo House": {
16
  "Whopper Meal": 7.99,
17
  "Chicken Fries": 3.99,
18
  "Impossible Whopper": 5.99,
 
30
  "Baja Blast Freeze": 2.49,
31
  "Cinnamon Twists": 1.99
32
  },
33
+ "Curry Kingdom": {
34
  "Big Mac-Meal": 6.49,
35
  "10-Piece Chicken-McNuggets": 4.29,
36
  "Filet Fish": 3.79,
 
112
  txt_extract = "extract the restaurants name keyword from the sentence :\n\n"+command
113
  restaurant_name = " ".join(((nlp(txt_extract)).strip()).title().split()[-2:])
114
  found_rest = False
115
+ print(restaurant_name)
116
  if(restaurant_name in restaurants.keys()):
117
  found_rest = True
118
 
 
120
  txt_extract = "extract the food item from the sentence :\n\n"+command
121
  item_name = " ".join(((nlp(txt_extract)).strip()).title().strip(".,;:").split()[-2:])
122
  found_item = False
123
+ print(item_name)
124
  for restaurant, rest_info in restaurants.items():
125
  if item_name in rest_info:
126
  found_item = True
127
+
128
 
129
  print(found_item , found_rest)
130
  if food_command in ['order', 'eat' , 'want' , 'serve' , 'prepare' ]:
 
137
  min_price = min(temp_val.values())
138
  res = [key for key in temp_val if temp_val[key] == min_price]
139
  response = f"You have ordered {item_name} from {res[0]} with price of {min_price}"
140
+
141
 
142
  elif found_rest and found_item:
143
  response = f"\nYou ordered {item_name} from {restaurant_name}\nGreat! Thank you for ordering."
 
168
 
169
  elif food_command in ['menu' , 'menus' , 'catalogue' , 'items' , 'something']:
170
  if found_rest:
171
+ print(restaurant_name)
172
  for restaurant_name in restaurants:
173
  if restaurant in command:
174
  menu_items = get_menu_items(restaurant)