joheras commited on
Commit
fc7adb5
1 Parent(s): 7610aac
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -16,12 +16,12 @@ def softmax(x):
16
  labels = ["apple", "aquarium_fish", "baby", "bear", "beaver", "bed", "bee", "beetle", "bicycle", "bottle", "bowl", "boy", "bridge", "bus", "butterfly", "camel", "can", "castle", "caterpillar", "cattle", "chair", "chimpanzee", "clock", "cloud", "cockroach", "couch", "cra", "crocodile", "cup", "dinosaur", "dolphin", "elephant", "flatfish", "forest", "fox", "girl", "hamster", "house", "kangaroo", "keyboard", "lamp", "lawn_mower", "leopard", "lion", "lizard", "lobster", "man", "maple_tree", "motorcycle", "mountain", "mouse", "mushroom", "oak_tree", "orange", "orchid", "otter", "palm_tree", "pear", "pickup_truck", "pine_tree", "plain", "plate", "poppy", "porcupine", "possum", "rabbit", "raccoon", "ray", "road", "rocket", "rose", "sea", "seal", "shark", "shrew", "skunk", "skyscraper", "snail", "snake", "spider", "squirrel", "streetcar", "sunflower", "sweet_pepper", "table", "tank", "telephone", "television", "tiger", "tractor", "train", "trout", "tulip", "turtle", "wardrobe", "whale", "willow_tree", "wolf", "woman", "worm"]
17
 
18
  def classify_image(image):
19
- image = image.reshape((1, 32, 32, 3))
20
  pred = model.predict(image)
21
  prediction = softmax(pred)[0]
22
  return {labels[i]: float(prediction[i]) for i in range(100)}
23
 
24
- image = gr.inputs.Image()
25
  label = gr.outputs.Label(num_top_classes=5)
26
 
27
  iface = gr.Interface(classify_image,image,label,
 
16
  labels = ["apple", "aquarium_fish", "baby", "bear", "beaver", "bed", "bee", "beetle", "bicycle", "bottle", "bowl", "boy", "bridge", "bus", "butterfly", "camel", "can", "castle", "caterpillar", "cattle", "chair", "chimpanzee", "clock", "cloud", "cockroach", "couch", "cra", "crocodile", "cup", "dinosaur", "dolphin", "elephant", "flatfish", "forest", "fox", "girl", "hamster", "house", "kangaroo", "keyboard", "lamp", "lawn_mower", "leopard", "lion", "lizard", "lobster", "man", "maple_tree", "motorcycle", "mountain", "mouse", "mushroom", "oak_tree", "orange", "orchid", "otter", "palm_tree", "pear", "pickup_truck", "pine_tree", "plain", "plate", "poppy", "porcupine", "possum", "rabbit", "raccoon", "ray", "road", "rocket", "rose", "sea", "seal", "shark", "shrew", "skunk", "skyscraper", "snail", "snake", "spider", "squirrel", "streetcar", "sunflower", "sweet_pepper", "table", "tank", "telephone", "television", "tiger", "tractor", "train", "trout", "tulip", "turtle", "wardrobe", "whale", "willow_tree", "wolf", "woman", "worm"]
17
 
18
  def classify_image(image):
19
+ image = image.reshape((-1, 32, 32, 3))
20
  pred = model.predict(image)
21
  prediction = softmax(pred)[0]
22
  return {labels[i]: float(prediction[i]) for i in range(100)}
23
 
24
+ image = gr.inputs.Image(shape(32,32))
25
  label = gr.outputs.Label(num_top_classes=5)
26
 
27
  iface = gr.Interface(classify_image,image,label,