Phoenix21 commited on
Commit
62b9066
·
verified ·
1 Parent(s): f5296e8

Handled input like "sleep anxiety"

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -68,13 +68,13 @@ def is_valid_input(text):
68
  if not text or text.strip() == "":
69
  return False, "Input cannot be empty. Please provide a meaningful question."
70
 
71
- if len(text.strip()) < 5:
72
- return False, "Input is too short. Please provide a more detailed question."
73
 
74
- # Gibberish detection: Ensure text contains valid words
75
  words = re.findall(r'\b\w+\b', text)
76
- if len(words) < 3: # Require at least three recognizable words
77
- return False, "Input appears incomplete. Please provide a more meaningful question."
78
 
79
  return True, "Valid input."
80
 
 
68
  if not text or text.strip() == "":
69
  return False, "Input cannot be empty. Please provide a meaningful question."
70
 
71
+ if len(text.strip()) < 2:
72
+ return False, "Input is too short. Please provide more context or details."
73
 
74
+ # Check if the input has at least one valid word
75
  words = re.findall(r'\b\w+\b', text)
76
+ if len(words) < 1: # Require at least one recognizable word
77
+ return False, "Input appears incomplete. Please provide a meaningful question."
78
 
79
  return True, "Valid input."
80