Spaces:
Runtime error
Runtime error
Update pages/recommend.py
Browse files- pages/recommend.py +6 -1
pages/recommend.py
CHANGED
@@ -21,7 +21,12 @@ rain(
|
|
21 |
)
|
22 |
|
23 |
def recommend(course):
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
25 |
dist1 = (similarity[index])
|
26 |
distances = sorted(list(enumerate(dist1)), reverse=True, key=lambda x: x[1])
|
27 |
dist = pd.DataFrame(dist1)
|
|
|
21 |
)
|
22 |
|
23 |
def recommend(course):
|
24 |
+
course_index = courses_list[courses_list['course_name'] == course].index
|
25 |
+
if len(course_index) == 0:
|
26 |
+
st.error(f"Course '{course}' not found in the dataset.")
|
27 |
+
return
|
28 |
+
|
29 |
+
index = course_index[0]
|
30 |
dist1 = (similarity[index])
|
31 |
distances = sorted(list(enumerate(dist1)), reverse=True, key=lambda x: x[1])
|
32 |
dist = pd.DataFrame(dist1)
|