Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from tensorflow.keras.preprocessing.sequence import pad_sequences
|
|
| 8 |
from nltk.corpus import stopwords
|
| 9 |
from sklearn.preprocessing import StandardScaler
|
| 10 |
import nltk
|
|
|
|
| 11 |
|
| 12 |
# Download required NLTK data (for stopwords only)
|
| 13 |
nltk.download('stopwords')
|
|
@@ -77,7 +78,7 @@ def predict_menu_inclusion(food_name, review_text, cook_time, prep_time, total_t
|
|
| 77 |
predicted_rating = model.predict([padded_review, numerical_features]).flatten()[0]
|
| 78 |
|
| 79 |
# Decide whether to include the item on the menu
|
| 80 |
-
include_on_menu = predicted_rating >
|
| 81 |
|
| 82 |
return {
|
| 83 |
"FoodName": food_name,
|
|
@@ -164,4 +165,3 @@ if st.sidebar.button("🔮 Predict"):
|
|
| 164 |
unsafe_allow_html=True,
|
| 165 |
)
|
| 166 |
|
| 167 |
-
|
|
|
|
| 8 |
from nltk.corpus import stopwords
|
| 9 |
from sklearn.preprocessing import StandardScaler
|
| 10 |
import nltk
|
| 11 |
+
import time
|
| 12 |
|
| 13 |
# Download required NLTK data (for stopwords only)
|
| 14 |
nltk.download('stopwords')
|
|
|
|
| 78 |
predicted_rating = model.predict([padded_review, numerical_features]).flatten()[0]
|
| 79 |
|
| 80 |
# Decide whether to include the item on the menu
|
| 81 |
+
include_on_menu = predicted_rating > 3.5 # Threshold for inclusion
|
| 82 |
|
| 83 |
return {
|
| 84 |
"FoodName": food_name,
|
|
|
|
| 165 |
unsafe_allow_html=True,
|
| 166 |
)
|
| 167 |
|
|
|