wrapper228 commited on
Commit
09ffd87
1 Parent(s): 3d8f9f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -11,9 +11,9 @@ with open('labels.pickle', 'rb') as handle:
11
 
12
  # @st.cache
13
  def predict_topic_by_title_and_abstract(text):
14
- tokenized_text = tokenizer(text, return_tensors='pt', truncation=True)
15
  with torch.no_grad():
16
- logits = model(**tokenized_text).logits
17
  probs = torch.nn.functional.softmax(logits[0], dim=0).numpy() * 100
18
  ans = list(zip(probs,labels.values()))
19
  ans.sort(reverse=True)
@@ -40,9 +40,9 @@ st.image(image)
40
  st.markdown("##### This app predicts the probabilities of the article belonging to the following topics: \'biology\', \'computer science\', \'economics\', \'electrics\', \'finance\', \'math\', \'physics\', \'statistics\'.")
41
  st.markdown("##### To get an article topic prediction, please write down it's title, abstract, or both.")
42
 
43
- title = st.text_area("Write article title:", height=30)
44
 
45
- abstract = st.text_area("Write article abstract:", height=60)
46
 
47
  input_text = title + " " + abstract
48
 
 
11
 
12
  # @st.cache
13
  def predict_topic_by_title_and_abstract(text):
14
+ tokens = tokenizer(text, return_tensors='pt', truncation=True)
15
  with torch.no_grad():
16
+ logits = model(**tokens).logits
17
  probs = torch.nn.functional.softmax(logits[0], dim=0).numpy() * 100
18
  ans = list(zip(probs,labels.values()))
19
  ans.sort(reverse=True)
 
40
  st.markdown("##### This app predicts the probabilities of the article belonging to the following topics: \'biology\', \'computer science\', \'economics\', \'electrics\', \'finance\', \'math\', \'physics\', \'statistics\'.")
41
  st.markdown("##### To get an article topic prediction, please write down it's title, abstract, or both.")
42
 
43
+ title = st.text_area("Write article title:", height=30, unsafe_allow_html=True)
44
 
45
+ abstract = st.text_area("Write article abstract:", height=60, unsafe_allow_html=True)
46
 
47
  input_text = title + " " + abstract
48