aliasgerovs commited on
Commit
c10af95
1 Parent(s): 42fb43c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -224,9 +224,11 @@ def split_text_allow_complete_sentences_nltk(text, max_length=256, tolerance=30,
224
 
225
  if type_det == 'bc':
226
  tokenizer = text_bc_tokenizer
 
227
 
228
  elif type_det == 'mc':
229
  tokenizer = text_mc_tokenizer
 
230
 
231
  for sentence in sentences:
232
  tokens = tokenizer.tokenize(sentence)
@@ -282,7 +284,7 @@ def predict_bc(model, tokenizer, text):
282
  with torch.no_grad():
283
  model.eval()
284
  tokens = text_bc_tokenizer(
285
- text, padding='max_length', truncation=True, max_length=256, return_tensors="pt"
286
  ).to(device)
287
  output = model(**tokens)
288
  output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]
 
224
 
225
  if type_det == 'bc':
226
  tokenizer = text_bc_tokenizer
227
+ max_length = 333
228
 
229
  elif type_det == 'mc':
230
  tokenizer = text_mc_tokenizer
231
+ max_length = 256
232
 
233
  for sentence in sentences:
234
  tokens = tokenizer.tokenize(sentence)
 
284
  with torch.no_grad():
285
  model.eval()
286
  tokens = text_bc_tokenizer(
287
+ text, padding='max_length', truncation=True, max_length=333, return_tensors="pt"
288
  ).to(device)
289
  output = model(**tokens)
290
  output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]