arkmartov commited on
Commit
fc3e0b1
·
1 Parent(s): 2460eee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -11,7 +11,7 @@ def Model():
11
  return model, tokenizer
12
 
13
  def Predict(model, tokenizer, text):
14
- res = tokenizer(s, padding=True, truncation=True, return_tensors="pt", max_length=512)
15
  res = model(**res)
16
  logits = res.logits.softmax(dim=1)
17
  logits = logits.numpy()[0]#.cpu().detach().numpy()[0]
@@ -20,10 +20,10 @@ def Predict(model, tokenizer, text):
20
  def Print(logits, dictionary):
21
  z = zip(logits, np.arange(0, 8))
22
  z = sorted(z, key=lambda x: x[0], reverse=True)
23
- sum, idx = 0, 0
24
- while sum < 0.95:
25
  st.markdown(f"{idx + 1}. ", dictionary[z[idx][1]])
26
- sum += z[idx][0]
27
  idx += 1
28
 
29
  def filter(title, abstract):
 
11
  return model, tokenizer
12
 
13
  def Predict(model, tokenizer, text):
14
+ res = tokenizer(text, padding=True, truncation=True, return_tensors="pt", max_length=512)
15
  res = model(**res)
16
  logits = res.logits.softmax(dim=1)
17
  logits = logits.numpy()[0]#.cpu().detach().numpy()[0]
 
20
  def Print(logits, dictionary):
21
  z = zip(logits, np.arange(0, 8))
22
  z = sorted(z, key=lambda x: x[0], reverse=True)
23
+ summ, idx = 0, 0
24
+ while summ < 0.95:
25
  st.markdown(f"{idx + 1}. ", dictionary[z[idx][1]])
26
+ summ += z[idx][0]
27
  idx += 1
28
 
29
  def filter(title, abstract):