Spaces:
Runtime error
Runtime error
Commit
·
b0c7c8c
1
Parent(s):
e22b879
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,20 +107,19 @@ def main(audio):
|
|
| 107 |
print(f"You said: {command}")
|
| 108 |
txt_command ="extract the food related command keyword from the sentence :\n\n"+command
|
| 109 |
food_command = (" ".join(nlp(txt_command).strip().split()[-1:])).lower()
|
|
|
|
| 110 |
|
| 111 |
restaurant_name = ''
|
| 112 |
-
txt_extract = "extract the restaurants name
|
| 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 |
|
| 119 |
item_name = ''
|
| 120 |
-
txt_extract = "extract the food
|
| 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
|
|
@@ -167,11 +166,8 @@ def main(audio):
|
|
| 167 |
|
| 168 |
|
| 169 |
elif food_command in ['menu' , 'menus' , 'catalogue' , 'items' , 'something']:
|
| 170 |
-
if found_rest:
|
| 171 |
-
|
| 172 |
-
for restaurant_name in restaurants:
|
| 173 |
-
if restaurant in command:
|
| 174 |
-
menu_items = get_menu_items(restaurant)
|
| 175 |
response = f"Here's the menu for {restaurant}: {menu_items}"
|
| 176 |
break
|
| 177 |
else:
|
|
|
|
| 107 |
print(f"You said: {command}")
|
| 108 |
txt_command ="extract the food related command keyword from the sentence :\n\n"+command
|
| 109 |
food_command = (" ".join(nlp(txt_command).strip().split()[-1:])).lower()
|
| 110 |
+
print(food_command)
|
| 111 |
|
| 112 |
restaurant_name = ''
|
| 113 |
+
txt_extract = "extract the restaurants name from the sentence :\n\n"+command
|
| 114 |
restaurant_name = " ".join(((nlp(txt_extract)).strip()).title().split()[-2:])
|
| 115 |
found_rest = False
|
|
|
|
| 116 |
if(restaurant_name in restaurants.keys()):
|
| 117 |
found_rest = True
|
| 118 |
|
| 119 |
item_name = ''
|
| 120 |
+
txt_extract = "extract the food name from the given sentence :\n\n"+command
|
| 121 |
item_name = " ".join(((nlp(txt_extract)).strip()).title().strip(".,;:").split()[-2:])
|
| 122 |
found_item = False
|
|
|
|
| 123 |
for restaurant, rest_info in restaurants.items():
|
| 124 |
if item_name in rest_info:
|
| 125 |
found_item = True
|
|
|
|
| 166 |
|
| 167 |
|
| 168 |
elif food_command in ['menu' , 'menus' , 'catalogue' , 'items' , 'something']:
|
| 169 |
+
if found_rest:
|
| 170 |
+
menu_items = get_menu_items(restaurant_name)
|
|
|
|
|
|
|
|
|
|
| 171 |
response = f"Here's the menu for {restaurant}: {menu_items}"
|
| 172 |
break
|
| 173 |
else:
|