andrewzamp commited on
Commit
ad3d1fe
·
1 Parent(s): d33d3aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -48,12 +48,18 @@ def load_and_preprocess_image(image, target_size=(224, 224)):
48
  return img_array
49
 
50
  # Function to make predictions
51
- def make_prediction(image, taxonomic_level):
 
 
 
 
 
 
52
  # Preprocess the image
53
  img_array = load_and_preprocess_image(image)
54
 
55
  # Get the class names from the 'species' column
56
- class_names = sorted(taxo_df['species'].unique()) # Add this line to define class_names
57
 
58
  # Make a prediction
59
  prediction = model.predict(img_array)
 
48
  return img_array
49
 
50
  # Function to make predictions
51
+ def make_prediction(image, taxonomic_decision, taxonomic_level):
52
+ # Determine the taxonomic level based on the user's decision
53
+ if taxonomic_decision == "Yes, I want to specify the taxonomic level":
54
+ taxonomic_level = taxonomic_level # Use the level specified in the dropdown
55
+ else:
56
+ taxonomic_level = "species" # Default to species if not specified
57
+
58
  # Preprocess the image
59
  img_array = load_and_preprocess_image(image)
60
 
61
  # Get the class names from the 'species' column
62
+ class_names = sorted(taxo_df['species'].unique())
63
 
64
  # Make a prediction
65
  prediction = model.predict(img_array)