Spaces:
Runtime error
Runtime error
Delete API_Mananga.py
Browse files- API_Mananga.py +0 -27
API_Mananga.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import tensorflow as tf
|
3 |
-
model_0 = tf.keras.models.load_model('bestmodel_porno_final_meilleure100%2.0.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 |
-
|
22 |
-
image = gr.inputs.Image(shape=(224, 224))
|
23 |
-
label = gr.outputs.Label(num_top_classes=3)
|
24 |
-
|
25 |
-
gr.Interface(
|
26 |
-
fn=classify_image, inputs=image, outputs=label, interpretation="default"
|
27 |
-
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|