Spaces:
Sleeping
Sleeping
correction de l'erreur pour les images nulles
Browse files
app.py
CHANGED
@@ -4,7 +4,9 @@ model_0 = tf.keras.models.load_model('bestmodel.h5')
|
|
4 |
def classify_image(inp):
|
5 |
inp = inp.reshape((-1, 224, 224, 3))
|
6 |
prediction = model_0.predict(inp)
|
7 |
-
if prediction.argmax()
|
|
|
|
|
8 |
output = "Rifle violence"
|
9 |
elif prediction.argmax() == 1:
|
10 |
output = "guns violence"
|
|
|
4 |
def classify_image(inp):
|
5 |
inp = inp.reshape((-1, 224, 224, 3))
|
6 |
prediction = model_0.predict(inp)
|
7 |
+
if prediction[prediction.argmax()] < 0.7:
|
8 |
+
output = "bonne image"
|
9 |
+
elif prediction.argmax() == 0:
|
10 |
output = "Rifle violence"
|
11 |
elif prediction.argmax() == 1:
|
12 |
output = "guns violence"
|