lukelike1001 commited on
Commit
dba60de
1 Parent(s): da999fb

updated to keras 3

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -6,7 +6,7 @@ from tensorflow import keras
6
 
7
  # load the pre-trained model from the appropriate file path
8
  def predict_plant(path):
9
- model = tf.keras.models.load_model('my_model/')
10
 
11
  # redefine values from the model
12
  img_height = img_width = 180
@@ -27,7 +27,7 @@ def predict_plant(path):
27
 
28
  # find the confidence probability for each plant
29
  predictions = model.predict(img_array)
30
- score = tf.nn.softmax(predictions[0])
31
  confidences = {class_names[i]: float(score[i]) for i in range(len(class_names))}
32
  return confidences
33
 
 
6
 
7
  # load the pre-trained model from the appropriate file path
8
  def predict_plant(path):
9
+ model = tf.keras.models.load_model('leaf_model.keras')
10
 
11
  # redefine values from the model
12
  img_height = img_width = 180
 
27
 
28
  # find the confidence probability for each plant
29
  predictions = model.predict(img_array)
30
+ score = tf.nn.softmax(predictions['outputs'][0])
31
  confidences = {class_names[i]: float(score[i]) for i in range(len(class_names))}
32
  return confidences
33