Spaces:
Sleeping
Sleeping
OmPrakashSingh1704
commited on
Commit
•
9753cc8
1
Parent(s):
13c4f24
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,13 @@ with open('items_dict.pkl', 'rb') as file:
|
|
22 |
|
23 |
mode=st.toggle(label="CUSTOMER")
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
def show_recipe(recipe):
|
26 |
name_and_dis = f'# {recipe["name"]}\n\n'
|
27 |
name_and_dis += f'{recipe["description"]}\n\n'
|
|
|
22 |
|
23 |
mode=st.toggle(label="CUSTOMER")
|
24 |
|
25 |
+
def get_recommendations(user_description, count_vectorizer, count_matrix):
|
26 |
+
user_description = preprocess_text(user_description)
|
27 |
+
user_vector = count_vectorizer.transform([user_description])
|
28 |
+
cosine_similarities = cosine_similarity(user_vector, count_matrix).flatten()
|
29 |
+
similar_indices = cosine_similarities.argsort()[::-1]
|
30 |
+
return similar_indices
|
31 |
+
|
32 |
def show_recipe(recipe):
|
33 |
name_and_dis = f'# {recipe["name"]}\n\n'
|
34 |
name_and_dis += f'{recipe["description"]}\n\n'
|