Maverick98 commited on
Commit
b6ae06c
·
verified ·
1 Parent(s): 6469b59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -86,6 +86,11 @@ def load_image(image_path_or_url):
86
  return image
87
 
88
  def predict(image_path_or_file, title, threshold=0.4):
 
 
 
 
 
89
  # Preprocess the image
90
  image = load_image(image_path_or_file)
91
 
 
86
  return image
87
 
88
  def predict(image_path_or_file, title, threshold=0.4):
89
+
90
+ # Validation: Check if the title is empty or has fewer than 3 words
91
+ if not title or len(title.split()) < 3:
92
+ raise gr.Error("Title must be at least 3 words long. Please provide a valid title.")
93
+
94
  # Preprocess the image
95
  image = load_image(image_path_or_file)
96