Spaces:
Sleeping
Sleeping
added error handling
Browse files
app.py
CHANGED
@@ -56,6 +56,9 @@ def predict_image(image, model_choice):
|
|
56 |
# Check if a model is selected
|
57 |
if model_choice not in model_paths:
|
58 |
return "Error: Please select a valid model.", ""
|
|
|
|
|
|
|
59 |
|
60 |
# Load the selected model if it's not already loaded
|
61 |
if model_choice != current_model:
|
|
|
56 |
# Check if a model is selected
|
57 |
if model_choice not in model_paths:
|
58 |
return "Error: Please select a valid model.", ""
|
59 |
+
# Check if an image is provided
|
60 |
+
if image is None:
|
61 |
+
return "Error: Please upload an image.", ""
|
62 |
|
63 |
# Load the selected model if it's not already loaded
|
64 |
if model_choice != current_model:
|