Spaces:
Running
Running
aliasgerovs
commited on
Commit
•
4df475b
1
Parent(s):
243e250
Updated
Browse files
app.py
CHANGED
@@ -213,7 +213,7 @@ def update_character_count(text):
|
|
213 |
return f"{len(text)} characters"
|
214 |
|
215 |
|
216 |
-
def split_text_allow_complete_sentences_nltk(text, max_length=256, tolerance=30, min_last_segment_length=
|
217 |
sentences = nltk.sent_tokenize(text)
|
218 |
segments = []
|
219 |
current_segment = []
|
@@ -269,7 +269,7 @@ def split_text_allow_complete_sentences_nltk(text, max_length=256, tolerance=30,
|
|
269 |
|
270 |
def predict_bc(model, tokenizer, text):
|
271 |
tokens = text_bc_tokenizer(
|
272 |
-
text, padding='max_length', truncation=True, max_length=
|
273 |
).to(device)["input_ids"]
|
274 |
|
275 |
output = model(tokens)
|
|
|
213 |
return f"{len(text)} characters"
|
214 |
|
215 |
|
216 |
+
def split_text_allow_complete_sentences_nltk(text, max_length=256, tolerance=30, min_last_segment_length=100, type_det='bc'):
|
217 |
sentences = nltk.sent_tokenize(text)
|
218 |
segments = []
|
219 |
current_segment = []
|
|
|
269 |
|
270 |
def predict_bc(model, tokenizer, text):
|
271 |
tokens = text_bc_tokenizer(
|
272 |
+
text, padding='max_length', truncation=True, max_length=512, return_tensors="pt"
|
273 |
).to(device)["input_ids"]
|
274 |
|
275 |
output = model(tokens)
|