PirateXX commited on
Commit
a7553e2
·
1 Parent(s): fbb9dbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
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)