Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,30 +25,31 @@ def recommend(index):
|
|
| 25 |
|
| 26 |
return list(sorted_final.keys())
|
| 27 |
|
|
|
|
| 28 |
|
| 29 |
st.set_page_config(page_title='DiscoverCourses', page_icon=':book:')
|
| 30 |
-
|
| 31 |
|
| 32 |
-
selected_course =
|
| 33 |
|
| 34 |
-
if
|
| 35 |
output=recommend(np.where((coursedf['ref']+": "+coursedf['title']) == selected_course)[0][0])
|
| 36 |
for result in output:
|
| 37 |
index=np.where(coursedf['title'] == result)[0][0]
|
| 38 |
course_id=coursedf.iloc[index,0]
|
| 39 |
st.subheader(course_id+": "+result)
|
| 40 |
-
st.
|
| 41 |
-
link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+"
|
| 42 |
st.markdown(link, unsafe_allow_html=True)
|
| 43 |
st.divider()
|
| 44 |
|
| 45 |
-
if
|
| 46 |
index_new=np.where((coursedf['ref']+": "+coursedf['title']) == selected_course)[0][0]
|
| 47 |
rec_list=course_df_new.iloc[index_new,2]
|
| 48 |
for result in rec_list:
|
| 49 |
-
course_id=coursedf.iloc[
|
| 50 |
st.subheader(course_id+": "+result)
|
| 51 |
-
st.
|
| 52 |
-
link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+"
|
| 53 |
st.markdown(link, unsafe_allow_html=True)
|
| 54 |
st.divider()
|
|
|
|
| 25 |
|
| 26 |
return list(sorted_final.keys())
|
| 27 |
|
| 28 |
+
container = st.container()
|
| 29 |
|
| 30 |
st.set_page_config(page_title='DiscoverCourses', page_icon=':book:')
|
| 31 |
+
container.title('DiscoverCourses')
|
| 32 |
|
| 33 |
+
selected_course = container.selectbox('Pick a course',course_title_list)
|
| 34 |
|
| 35 |
+
if container.button('Recommend by title'):
|
| 36 |
output=recommend(np.where((coursedf['ref']+": "+coursedf['title']) == selected_course)[0][0])
|
| 37 |
for result in output:
|
| 38 |
index=np.where(coursedf['title'] == result)[0][0]
|
| 39 |
course_id=coursedf.iloc[index,0]
|
| 40 |
st.subheader(course_id+": "+result)
|
| 41 |
+
st.write(course_df_new.iloc[index,3]) #Using the new coursedf because it has proper descriptions for each course
|
| 42 |
+
link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+"+"+result+")"
|
| 43 |
st.markdown(link, unsafe_allow_html=True)
|
| 44 |
st.divider()
|
| 45 |
|
| 46 |
+
if container.button('Recommend by description'):
|
| 47 |
index_new=np.where((coursedf['ref']+": "+coursedf['title']) == selected_course)[0][0]
|
| 48 |
rec_list=course_df_new.iloc[index_new,2]
|
| 49 |
for result in rec_list:
|
| 50 |
+
course_id=coursedf.iloc[index_new,0]
|
| 51 |
st.subheader(course_id+": "+result)
|
| 52 |
+
st.write(course_df_new.iloc[index_new,3]) #Using the new coursedf because it has proper descriptions for each course
|
| 53 |
+
link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+"+"+result+")"
|
| 54 |
st.markdown(link, unsafe_allow_html=True)
|
| 55 |
st.divider()
|