rushankg commited on
Commit
b5b6069
·
1 Parent(s): 69979a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
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
- st.title('DiscoverCourses')
31
 
32
- selected_course = st.selectbox('Pick a course',course_title_list)
33
 
34
- if st.button('Recommend by title'):
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.text(course_df_new.iloc[index,3]) #Using the new coursedf because it has proper descriptions for each course
41
- link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+" "+result+")"
42
  st.markdown(link, unsafe_allow_html=True)
43
  st.divider()
44
 
45
- if st.button('Recommend by description'):
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[index,0]
50
  st.subheader(course_id+": "+result)
51
- st.text(course_df_new.iloc[index,3]) #Using the new coursedf because it has proper descriptions for each course
52
- link = "[ExploreCourses](https://explorecourses.stanford.edu/search?q="+course_id+" "+result+")"
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()