Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,13 +33,9 @@ def predict_image(image):
|
|
| 33 |
outputs = model(img_array)
|
| 34 |
predictions = tf.nn.softmax(outputs.logits, axis=-1)
|
| 35 |
predicted_class = np.argmax(predictions)
|
| 36 |
-
if predicted_class == 0:
|
| 37 |
-
predict_label = "Clean"
|
| 38 |
-
else:
|
| 39 |
-
predict_label = "Carries"
|
| 40 |
#confidence = float(np.max(predictions))
|
| 41 |
-
|
| 42 |
-
return json.dumps(prediction_dict, indent=1)
|
| 43 |
|
| 44 |
# Create the interface
|
| 45 |
input_interface = gr.Image(type = "pil")
|
|
|
|
| 33 |
outputs = model(img_array)
|
| 34 |
predictions = tf.nn.softmax(outputs.logits, axis=-1)
|
| 35 |
predicted_class = np.argmax(predictions)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
#confidence = float(np.max(predictions))
|
| 37 |
+
return{"prediction": predicted_class}
|
| 38 |
+
#return json.dumps(prediction_dict, indent=1)
|
| 39 |
|
| 40 |
# Create the interface
|
| 41 |
input_interface = gr.Image(type = "pil")
|