ilyshi commited on
Commit
f401857
1 Parent(s): 7ed1e45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -16,7 +16,7 @@ def print_probs(logits):
16
  while sum <= 95:
17
  prob, idx = ans[i]
18
  text = categories[idx] + ": "+ str(np.round(prob,1)) + "%"
19
- st.markdown(text)
20
  sum+=prob
21
  i+=1
22
 
@@ -24,7 +24,7 @@ def make_prediction(text):
24
  tokenized_text = tokenizer(text, return_tensors='pt')
25
  with torch.no_grad():
26
  pred_logits = model(**tokenized_text).logits
27
- st.markdown("Category probability:")
28
  print_probs(pred_logits[0])
29
 
30
 
@@ -41,8 +41,20 @@ model.load_state_dict(
41
  )
42
  )
43
 
44
- st.markdown("## Hello, people!")
 
 
 
45
  st.markdown("<img src='https://centroderecursosmarista.org/wp-content/uploads/2013/05/arvix.jpg'>", unsafe_allow_html=True)
46
- text = st.text_area("Введите описание статьи")
 
 
 
 
 
 
 
 
 
47
  make_prediction(text)
48
 
 
16
  while sum <= 95:
17
  prob, idx = ans[i]
18
  text = categories[idx] + ": "+ str(np.round(prob,1)) + "%"
19
+ st.write(text)
20
  sum+=prob
21
  i+=1
22
 
 
24
  tokenized_text = tokenizer(text, return_tensors='pt')
25
  with torch.no_grad():
26
  pred_logits = model(**tokenized_text).logits
27
+ st.write("Category probability:")
28
  print_probs(pred_logits[0])
29
 
30
 
 
41
  )
42
  )
43
 
44
+ # MAIN
45
+
46
+ st.markdown("# Arxiv.org category classifier")
47
+ st.markdown(" ")
48
  st.markdown("<img src='https://centroderecursosmarista.org/wp-content/uploads/2013/05/arvix.jpg'>", unsafe_allow_html=True)
49
+ st.markdown(" ")
50
+
51
+ st.markdown("### Article Title")
52
+ text = st.text_area("Введите название статьи", height=400)
53
+
54
+ st.markdown("### Article Abstract")
55
+ text = st.text_area("Введите описание статьи", height=400)
56
+
57
+
58
+
59
  make_prediction(text)
60