Sa-m commited on
Commit
afbdf77
1 Parent(s): c0d83e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -37,17 +37,15 @@ def classify_image(inp):
37
  inp = tf.keras.applications.nasnet.preprocess_input(inp)
38
  prediction = model.predict(inp)
39
  predicted_class_indices = np.argmax(prediction, axis=1)
40
- result = {}
41
 
42
  label_order = ["Burger King", "KFC", "McDonalds", "Other", "Starbucks", "Subway"]
43
 
44
- # Create a dictionary to hold the results
45
- result = {label: f"{prediction[labels[label]]:.2f}" for label in label_order}
 
 
46
 
47
- # Convert the dictionary to a string
48
- result_str = ", ".join([f"{label}: {value}" for label, value in result.items()])
49
 
50
- return result_str
51
 
52
 
53
 
 
37
  inp = tf.keras.applications.nasnet.preprocess_input(inp)
38
  prediction = model.predict(inp)
39
  predicted_class_indices = np.argmax(prediction, axis=1)
 
40
 
41
  label_order = ["Burger King", "KFC", "McDonalds", "Other", "Starbucks", "Subway"]
42
 
43
+ result = {label: f"{prediction[0][labels[label]]:.2f}" for label in label_order}
44
+
45
+ return result
46
+
47
 
 
 
48
 
 
49
 
50
 
51