Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import pickle
|
|
3 |
import pandas as pd
|
4 |
import torch
|
5 |
import numpy as np
|
|
|
6 |
|
7 |
cosine_scores = pickle.load(open('cosine_scores.pkl','rb'))
|
8 |
coursedf = pd.read_pickle('course_df.pkl')
|
@@ -31,4 +32,12 @@ st.title('DiscoverCourses')
|
|
31 |
selected_course = st.selectbox('Please select a course',course_title_list)
|
32 |
|
33 |
if st.button('I want more like this!'):
|
34 |
-
st.write(recommend(np.where((coursedf['ref']+": "+coursedf['title']) == selected_course)[0][0]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import pandas as pd
|
4 |
import torch
|
5 |
import numpy as np
|
6 |
+
from streamlit_card import card
|
7 |
|
8 |
cosine_scores = pickle.load(open('cosine_scores.pkl','rb'))
|
9 |
coursedf = pd.read_pickle('course_df.pkl')
|
|
|
32 |
selected_course = st.selectbox('Please select a course',course_title_list)
|
33 |
|
34 |
if st.button('I want more like this!'):
|
35 |
+
st.write(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 |
+
card(
|
40 |
+
title=course_id,
|
41 |
+
text=result,
|
42 |
+
url="https://explorecourses.stanford.edu/search?q="+course_id+": "+result
|
43 |
+
)
|