Rahmat82 commited on
Commit
d1b874a
·
verified ·
1 Parent(s): b131941

input validation

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -10,7 +10,7 @@ SECRET_KEY = os.environ.get("summarizer")
10
 
11
  # asynchronous function
12
  async def summarize(text, retries=3):
13
- if len(re.findall(r'[.!?]+', text)) < 3:
14
  return "<span style='color: red;'>Error: Input should contain more than a few sentences.</span>"
15
  headers = {"Authorization": f"Bearer {SECRET_KEY}"}
16
  data = {
 
10
 
11
  # asynchronous function
12
  async def summarize(text, retries=3):
13
+ if len(re.findall(r'[.!?]+', text)) < 3 and len(text)<60:
14
  return "<span style='color: red;'>Error: Input should contain more than a few sentences.</span>"
15
  headers = {"Authorization": f"Bearer {SECRET_KEY}"}
16
  data = {