ZELEFACK commited on
Commit
f3f5f2f
·
1 Parent(s): 3ba095c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
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[0][prediction.argmax()]>0.00: # precision
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
 
 
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