Spaces:
Running
Running
aliasgerovs
commited on
Commit
•
c99be96
1
Parent(s):
4fe4f07
Update app.py
Browse files
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 |
-
|
278 |
-
|
279 |
-
|
|
|
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 |
|