Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 45 |
-
|
|
|
|
|
|
|
| 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 |
|