ZELEFACK commited on
Commit
f2424e1
·
1 Parent(s): 693b5b6

Update app.py

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