Spaces:
Runtime error
Runtime error
Add application file
Browse files
app.py
CHANGED
|
@@ -51,6 +51,7 @@ with open("scene_labels.json") as labels_file:
|
|
| 51 |
|
| 52 |
def classify_image(img):
|
| 53 |
img = tf.convert_to_tensor(img, dtype=tf.float32)
|
|
|
|
| 54 |
# pred,idx,probs = model.predict(img)
|
| 55 |
probs = model.predict(img)
|
| 56 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
|
|
|
| 51 |
|
| 52 |
def classify_image(img):
|
| 53 |
img = tf.convert_to_tensor(img, dtype=tf.float32)
|
| 54 |
+
img = tf.expand_dims(img, axis=0)
|
| 55 |
# pred,idx,probs = model.predict(img)
|
| 56 |
probs = model.predict(img)
|
| 57 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|