aliasgerovs commited on
Commit
c99be96
1 Parent(s): 4fe4f07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -274,9 +274,10 @@ def build_date(year, month, day):
274
  return f"{year}{months[month]}{day}"
275
 
276
  def len_validator(text):
277
- min_chars = 350
278
- if len(text) < min_chars:
279
- return f"Warning! Input length is {len(text)}. Please input a text that is greater than {min_chars} characters long. Recommended length {min_chars*2} characters."
 
280
  else :
281
  return f"Input length is satisified."
282
 
 
274
  return f"{year}{months[month]}{day}"
275
 
276
  def len_validator(text):
277
+ min_tokens = 128
278
+ lengt = len(tokenizer.tokenize(text = text, return_tensors="pt"))
279
+ if lengt < min_tokens:
280
+ return f"Warning! Input length is {lengt}. Please input a text that is greater than {min_tokens} tokens long. Recommended length {min_tokens*2} tokens."
281
  else :
282
  return f"Input length is satisified."
283