yuragoithf commited on
Commit
92e65a5
·
1 Parent(s): e980426

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -32,14 +32,21 @@ model_file = download_model()
32
  model = tf.keras.models.load_model(model_file)
33
 
34
  # Perform image classification
 
 
 
 
 
 
 
 
 
35
  def predict_class(image):
36
  img = tf.cast(image, tf.float32)
37
  img = tf.image.resize(img, [input_shape[0], input_shape[1]])
38
  img = tf.expand_dims(img, axis=0)
39
  prediction = model.predict(img)
40
- class_index = tf.argmax(prediction[0]).numpy()
41
- predicted_class = labels[class_index]
42
- return predicted_class
43
 
44
  # UI Design
45
  # def classify_image(image):
 
32
  model = tf.keras.models.load_model(model_file)
33
 
34
  # Perform image classification
35
+ # def predict_class(image):
36
+ # img = tf.cast(image, tf.float32)
37
+ # img = tf.image.resize(img, [input_shape[0], input_shape[1]])
38
+ # img = tf.expand_dims(img, axis=0)
39
+ # prediction = model.predict(img)
40
+ # class_index = tf.argmax(prediction[0]).numpy()
41
+ # predicted_class = labels[class_index]
42
+ # return predicted_class
43
+
44
  def predict_class(image):
45
  img = tf.cast(image, tf.float32)
46
  img = tf.image.resize(img, [input_shape[0], input_shape[1]])
47
  img = tf.expand_dims(img, axis=0)
48
  prediction = model.predict(img)
49
+ return prediction
 
 
50
 
51
  # UI Design
52
  # def classify_image(image):