alibayram commited on
Commit
1d98dcd
·
1 Parent(s): 9cc90a0

Refactor prediction function: update data handling to reshape composite image for prediction

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -28,8 +28,11 @@ model = tf.keras.models.load_model("./sketch_recognition_numbers_model.h5")
28
 
29
  # Prediction function for sketch recognition
30
  def predict(data):
 
 
 
31
  # Reshape image to 28x28
32
- img = np.reshape(data, (1, img_size, img_size, 1))
33
  # Make prediction
34
  pred = model.predict(img)
35
  # Get top class
 
28
 
29
  # Prediction function for sketch recognition
30
  def predict(data):
31
+ print(data)
32
+ # ValueError: cannot reshape array of size 1 into shape (1,28,28,1)
33
+
34
  # Reshape image to 28x28
35
+ img = np.reshape(data['composite'], (1, img_size, img_size, 1))
36
  # Make prediction
37
  pred = model.predict(img)
38
  # Get top class