ZELEFACK commited on
Commit
bbbaf12
1 Parent(s): 7689af3

correction de l'erreur pour les images nulles

Browse files
Files changed (1) hide show
  1. app.py +3 -1
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() == 0:
 
 
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"