Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
|