Spaces:
Runtime error
Runtime error
aliasgerovs
commited on
Commit
·
137dab1
1
Parent(s):
7d6e8b2
Updated
Browse files
app.py
CHANGED
@@ -223,9 +223,11 @@ def split_text_allow_complete_sentences_nltk(text, max_length=256, tolerance=30,
|
|
223 |
|
224 |
if type_det == 'bc':
|
225 |
tokenizer = text_bc_tokenizer
|
|
|
226 |
|
227 |
elif type_det == 'mc':
|
228 |
tokenizer = text_mc_tokenizer
|
|
|
229 |
|
230 |
for sentence in sentences:
|
231 |
tokens = tokenizer.tokenize(sentence)
|
@@ -277,7 +279,7 @@ def predict_quillbot(text):
|
|
277 |
|
278 |
def predict_bc(model, tokenizer, text):
|
279 |
tokens = text_bc_tokenizer(
|
280 |
-
text, padding='max_length', truncation=True, max_length=
|
281 |
).to(device)["input_ids"]
|
282 |
output = model(tokens)
|
283 |
output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]
|
|
|
223 |
|
224 |
if type_det == 'bc':
|
225 |
tokenizer = text_bc_tokenizer
|
226 |
+
max_length = 333
|
227 |
|
228 |
elif type_det == 'mc':
|
229 |
tokenizer = text_mc_tokenizer
|
230 |
+
max_length = 256
|
231 |
|
232 |
for sentence in sentences:
|
233 |
tokens = tokenizer.tokenize(sentence)
|
|
|
279 |
|
280 |
def predict_bc(model, tokenizer, text):
|
281 |
tokens = text_bc_tokenizer(
|
282 |
+
text, padding='max_length', truncation=True, max_length=333, return_tensors="pt"
|
283 |
).to(device)["input_ids"]
|
284 |
output = model(tokens)
|
285 |
output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]
|