yuragoithf commited on
Commit
021cf70
1 Parent(s): a3cd4d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -33,22 +33,23 @@ model_file = download_model()
33
  model = tf.keras.models.load_model(model_file)
34
 
35
  # Perform image classification for single class output
36
- # def predict_class(image):
37
- # img = tf.cast(image, tf.float32)
38
- # img = tf.image.resize(img, [input_shape[0], input_shape[1]])
39
- # img = tf.expand_dims(img, axis=0)
40
- # prediction = model.predict(img)
41
- # class_index = tf.argmax(prediction[0]).numpy()
42
- # predicted_class = labels[class_index]
43
- # return predicted_class
44
-
45
- # Perform image classification for multy class output
46
  def predict_class(image):
47
  img = tf.cast(image, tf.float32)
48
  img = tf.image.resize(img, [input_shape[0], input_shape[1]])
49
  img = tf.expand_dims(img, axis=0)
50
  prediction = model.predict(img)
51
- return prediction[0]
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  # UI Design for single class output
54
  def classify_image(image):
 
33
  model = tf.keras.models.load_model(model_file)
34
 
35
  # Perform image classification for single class output
 
 
 
 
 
 
 
 
 
 
36
  def predict_class(image):
37
  img = tf.cast(image, tf.float32)
38
  img = tf.image.resize(img, [input_shape[0], input_shape[1]])
39
  img = tf.expand_dims(img, axis=0)
40
  prediction = model.predict(img)
41
+ class_index = tf.argmax(prediction[0]).numpy()
42
+ predicted_class = labels[class_index]
43
+ print("predicted_class is ", predicted_class)####################################################
44
+ return predicted_class
45
+
46
+ # Perform image classification for multy class output
47
+ # def predict_class(image):
48
+ # img = tf.cast(image, tf.float32)
49
+ # img = tf.image.resize(img, [input_shape[0], input_shape[1]])
50
+ # img = tf.expand_dims(img, axis=0)
51
+ # prediction = model.predict(img)
52
+ # return prediction[0]
53
 
54
  # UI Design for single class output
55
  def classify_image(image):