NKASG commited on
Commit
acea513
·
verified ·
1 Parent(s): 090e57f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -30,7 +30,7 @@ class_labels = [
30
 
31
  def classify_image(img):
32
  pred, idx, probs = learn.predict(img)
33
- highest_prob_index = probs.argmax()
34
  img = Image.fromarray((img * 255).astype(np.uint8))
35
  img = img.resize((224, 224))
36
  img_array = tf.keras.preprocessing.image.img_to_array(img)
@@ -39,8 +39,9 @@ def classify_image(img):
39
 
40
  predictions = model.predict(img_array)
41
  predicted_class = class_labels[np.argmax(predictions)]
 
42
 
43
- return "The cloth belongs to category categories[highest_prob_index] a predicted_class material"
44
 
45
 
46
  iface = gr.Interface(
 
30
 
31
  def classify_image(img):
32
  pred, idx, probs = learn.predict(img)
33
+
34
  img = Image.fromarray((img * 255).astype(np.uint8))
35
  img = img.resize((224, 224))
36
  img_array = tf.keras.preprocessing.image.img_to_array(img)
 
39
 
40
  predictions = model.predict(img_array)
41
  predicted_class = class_labels[np.argmax(predictions)]
42
+ highest_prob_index = probs.argmax()
43
 
44
+ return categories[highest_prob_index]
45
 
46
 
47
  iface = gr.Interface(