djairbee5 commited on
Commit
4f172d5
1 Parent(s): 3a24c21

added error handling

Browse files
Files changed (1) hide show
  1. app.py +3 -0
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: