Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,8 @@ def predict_class(image):
|
|
47 |
img = tf.cast(image, tf.float32)
|
48 |
img = tf.image.resize(img, [input_shape[0], input_shape[1]])
|
49 |
img = tf.expand_dims(img, axis=0)
|
50 |
-
prediction = model.predict(img)
|
51 |
-
return prediction
|
52 |
|
53 |
# UI Design for single class output
|
54 |
# def classify_image(image):
|
@@ -59,8 +59,7 @@ def predict_class(image):
|
|
59 |
|
60 |
# UI Design for multy class output
|
61 |
def classify_image(image):
|
62 |
-
results = predict_class(image)
|
63 |
-
print(results)
|
64 |
output = {labels.get(i): float(results[i]) for i in range(len(results))}
|
65 |
result = output if max(output.values()) >=0.98 else {"NO_CIFAR10_CLASS": 1}
|
66 |
return result[0]
|
|
|
47 |
img = tf.cast(image, tf.float32)
|
48 |
img = tf.image.resize(img, [input_shape[0], input_shape[1]])
|
49 |
img = tf.expand_dims(img, axis=0)
|
50 |
+
prediction = model.predict(img)[0]
|
51 |
+
return prediction
|
52 |
|
53 |
# UI Design for single class output
|
54 |
# def classify_image(image):
|
|
|
59 |
|
60 |
# UI Design for multy class output
|
61 |
def classify_image(image):
|
62 |
+
results = predict_class(image)
|
|
|
63 |
output = {labels.get(i): float(results[i]) for i in range(len(results))}
|
64 |
result = output if max(output.values()) >=0.98 else {"NO_CIFAR10_CLASS": 1}
|
65 |
return result[0]
|