tushifire commited on
Commit
1b6713e
·
1 Parent(s): cffca32

Display in markdown list

Browse files
Files changed (1) hide show
  1. app.py +20 -4
app.py CHANGED
@@ -7,17 +7,33 @@ import pandas
7
 
8
 
9
  st.title('Arxiv Paper Recommendation')
10
- text_input = st.text_input(
11
  "Enter the title of any paper you like 👇",
12
  placeholder = "Paper title of your choice"
13
  )
14
 
15
- print(text_input)
16
 
 
 
17
 
 
 
18
 
 
19
  # Calculating the similarity between titles
20
- # cosine_scores = util.cos_sim(embeddings, model.encode(paper_you_like))
21
 
22
- # print(cosine_scores)
 
 
 
 
 
 
 
 
 
 
 
23
 
 
7
 
8
 
9
  st.title('Arxiv Paper Recommendation')
10
+ paper_you_like = st.text_input(
11
  "Enter the title of any paper you like 👇",
12
  placeholder = "Paper title of your choice"
13
  )
14
 
15
+ print(paper_you_like)
16
 
17
+ with open('sentences.pkl', 'rb') as f:
18
+ sentences = pickle.load(f)
19
 
20
+ with open('embeddings.pkl', 'rb') as f:
21
+ embeddings = pickle.load(f)
22
 
23
+
24
  # Calculating the similarity between titles
25
+ cosine_scores = util.cos_sim(embeddings, model.encode(paper_you_like))
26
 
27
+ print(cosine_scores)
28
+
29
+ import torch
30
+ top_similar_papers = torch.topk(cosine_scores,dim=0, k=5,sorted=True)
31
+ top_similar_papers
32
+
33
+ s = ''
34
+
35
+ for i in top_similar_papers:
36
+ s += "- " + i + "\n"
37
+
38
+ st.markdown(s)
39