Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,21 +4,18 @@ 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
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
output = "personne habillée"
|
| 18 |
-
else:
|
| 19 |
-
output = "tank violence"
|
| 20 |
else:
|
| 21 |
-
output = ""
|
| 22 |
return output
|
| 23 |
|
| 24 |
|
|
|
|
| 4 |
def classify_image(inp):
|
| 5 |
inp = inp.reshape((-1, 224, 224, 3))
|
| 6 |
prediction = model_0.predict(inp)
|
| 7 |
+
if prediction.argmax() == 0:
|
| 8 |
+
output = "Rifle violence"
|
| 9 |
+
elif prediction.argmax() == 1:
|
| 10 |
+
output = "guns violence"
|
| 11 |
+
elif prediction.argmax() == 2:
|
| 12 |
+
output = "knife violence"
|
| 13 |
+
elif prediction.argmax() == 3:
|
| 14 |
+
output = "image porno"
|
| 15 |
+
elif prediction.argmax() == 4:
|
| 16 |
+
output = "personne habillée"
|
|
|
|
|
|
|
|
|
|
| 17 |
else:
|
| 18 |
+
output = "tank violence"
|
| 19 |
return output
|
| 20 |
|
| 21 |
|