Sa-m commited on
Commit
3d5226b
1 Parent(s): 424c4e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -8,17 +8,18 @@ import os
8
  import numpy as np
9
 
10
 
11
- labels= { 'Subway': 0,'Starbucks': 1,'McDonalds': 2,'Burger King': 3,'KFC': 4,'Other': 5}
12
  HEIGHT,WIDTH=224,224
13
  NUM_CLASSES=6
14
 
15
  model=load_model('best_model.h5')
16
 
17
  def classify_image(inp):
 
18
  inp = inp.reshape((-1, HEIGHT,WIDTH, 3))
19
  inp = tf.keras.applications.nasnet.preprocess_input(inp)
20
  prediction = model.predict(inp)
21
- label = dict((v,k) for k,v in labels.items())
22
  predicted_class_indices=np.argmax(prediction,axis=1)
23
  return {labels[i]: float(predicted_class_indices[i]) for i in range(NUM_CLASSES)}
24
 
 
8
  import numpy as np
9
 
10
 
11
+ labels= {'Burger King': 0, 'KFC': 1,'McDonalds': 2,'Other': 3,'Starbucks': 4,'Subway': 5}
12
  HEIGHT,WIDTH=224,224
13
  NUM_CLASSES=6
14
 
15
  model=load_model('best_model.h5')
16
 
17
  def classify_image(inp):
18
+ np.random.seed(143)
19
  inp = inp.reshape((-1, HEIGHT,WIDTH, 3))
20
  inp = tf.keras.applications.nasnet.preprocess_input(inp)
21
  prediction = model.predict(inp)
22
+ #label = dict((v,k) for k,v in labels.items())
23
  predicted_class_indices=np.argmax(prediction,axis=1)
24
  return {labels[i]: float(predicted_class_indices[i]) for i in range(NUM_CLASSES)}
25