Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,10 @@ model.to(device)
|
|
22 |
# model_name = "roberta-base"
|
23 |
# tokenizer = RobertaTokenizer.from_pretrained(model_name, map_location=torch.device('cpu'))
|
24 |
|
|
|
|
|
|
|
|
|
25 |
def text_to_sentences(text):
|
26 |
clean_text = text.replace('\n', ' ')
|
27 |
return re.split(r'(?<=[^A-Z].[.?]) +(?=[A-Z])', clean_text)
|
|
|
22 |
# model_name = "roberta-base"
|
23 |
# tokenizer = RobertaTokenizer.from_pretrained(model_name, map_location=torch.device('cpu'))
|
24 |
|
25 |
+
def count_words(text):
|
26 |
+
words = text.split() # Split the text into a list of words
|
27 |
+
return len(words)
|
28 |
+
|
29 |
def text_to_sentences(text):
|
30 |
clean_text = text.replace('\n', ' ')
|
31 |
return re.split(r'(?<=[^A-Z].[.?]) +(?=[A-Z])', clean_text)
|