rushic24 commited on
Commit
62e0ff6
1 Parent(s): 806795f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -14,19 +14,20 @@ for filename in os.listdir(directory):
14
  allImages.append(f)
15
 
16
  def flower_classifier(image):
17
- image = tf.convert_to_tensor(image, dtype=tf.int8)
18
  image = tf.image.resize(image, (224, 224))
19
  image = image / 255.0
20
  image = tf.expand_dims(image, 0)
21
- pred = model(image)
22
- labeldict = dict(zip([CLASSES[i] for i in range(len(pred))], pred))
23
- return labeldict
24
 
25
 
26
  iface = gr.Interface(flower_classifier,
27
- title = "Award-Winning Deep Learning Project",
28
- examples = allImages,
29
  inputs = gr.inputs.Image(),
30
  outputs = gr.outputs.Label(num_top_classes=5),
31
- capture_session=True)
 
 
32
  iface.launch(debug=True)
 
14
  allImages.append(f)
15
 
16
  def flower_classifier(image):
17
+ print(image.shape)
18
  image = tf.image.resize(image, (224, 224))
19
  image = image / 255.0
20
  image = tf.expand_dims(image, 0)
21
+ pred = np.argmax(model(image))
22
+ label = CLASSES[pred]
23
+ return label
24
 
25
 
26
  iface = gr.Interface(flower_classifier,
27
+ title = "Image Classification using BigTransfer (BiT)",
 
28
  inputs = gr.inputs.Image(),
29
  outputs = gr.outputs.Label(num_top_classes=5),
30
+ capture_session=True,
31
+ examples = allImages[:4],
32
+ )
33
  iface.launch(debug=True)