Spaces:
Runtime error
Runtime error
Commit
·
0d28102
1
Parent(s):
9efab44
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ restaurants = {
|
|
12 |
"Diet Coke": 2.99,
|
13 |
"Chocolate Chip Cookie": 2.99
|
14 |
},
|
15 |
-
"
|
16 |
"Whopper Meal": 7.99,
|
17 |
"Chicken Fries": 3.99,
|
18 |
"Impossible Whopper": 5.99,
|
@@ -107,15 +107,13 @@ 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 |
-
print(food_command)
|
111 |
|
112 |
restaurant_name = ''
|
113 |
txt_extract = "extract the restaurants name keyword 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 |
-
print(restaurant_name)
|
119 |
|
120 |
item_name = ''
|
121 |
txt_extract = "extract the food item from the sentence :\n\n"+command
|
@@ -124,7 +122,6 @@ def main(audio):
|
|
124 |
for restaurant, rest_info in restaurants.items():
|
125 |
if item_name in rest_info:
|
126 |
found_item = True
|
127 |
-
print(item_name)
|
128 |
|
129 |
print(found_item , found_rest)
|
130 |
if food_command in ['order', 'eat' , 'want' , 'serve' , 'prepare' ]:
|
@@ -133,7 +130,6 @@ def main(audio):
|
|
133 |
for restaurant, rest_info in restaurants.items():
|
134 |
if item_name in rest_info:
|
135 |
temp_val[restaurant] = rest_info[item_name]
|
136 |
-
print(temp_val)
|
137 |
if temp_val:
|
138 |
min_price = min(temp_val.values())
|
139 |
res = [key for key in temp_val if temp_val[key] == min_price]
|
|
|
12 |
"Diet Coke": 2.99,
|
13 |
"Chocolate Chip Cookie": 2.99
|
14 |
},
|
15 |
+
"Kfc King": {
|
16 |
"Whopper Meal": 7.99,
|
17 |
"Chicken Fries": 3.99,
|
18 |
"Impossible Whopper": 5.99,
|
|
|
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 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 |
|
118 |
item_name = ''
|
119 |
txt_extract = "extract the food item from the sentence :\n\n"+command
|
|
|
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' ]:
|
|
|
130 |
for restaurant, rest_info in restaurants.items():
|
131 |
if item_name in rest_info:
|
132 |
temp_val[restaurant] = rest_info[item_name]
|
|
|
133 |
if temp_val:
|
134 |
min_price = min(temp_val.values())
|
135 |
res = [key for key in temp_val if temp_val[key] == min_price]
|