Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,33 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import tensorflow as tf
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
output = "personne habill茅e"
|
| 17 |
else:
|
| 18 |
-
|
| 19 |
-
return
|
| 20 |
|
| 21 |
|
| 22 |
-
image = gr.inputs.
|
| 23 |
-
label = gr.outputs.Label(num_top_classes=3)
|
| 24 |
|
| 25 |
gr.Interface(
|
| 26 |
-
fn=classify_image,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
).launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import tensorflow as tf
|
| 3 |
+
import numpy as np
|
| 4 |
+
import cv2
|
| 5 |
+
|
| 6 |
+
new_model = tf.keras.models.load_model('best_model_mammography.h5')
|
| 7 |
+
|
| 8 |
+
def classify_image(file_name):
|
| 9 |
+
img1 = cv2.imread(file_name.name.replace("\\",'/'),0)
|
| 10 |
+
img = cv2.resize(img1, (224,224))
|
| 11 |
+
img = img.reshape(img.shape[0],img.shape[1],1)
|
| 12 |
+
pred = new_model.predict(np.array([img]))
|
| 13 |
+
pred = np.round(pred,1)
|
| 14 |
+
if pred == 0:
|
| 15 |
+
pred = "V么tre cancer est Begnine"
|
|
|
|
| 16 |
else:
|
| 17 |
+
pred= "V么tre cancer est maline"
|
| 18 |
+
return pred
|
| 19 |
|
| 20 |
|
| 21 |
+
image = gr.inputs.File( file_count="single",type="file", label="Fichier 脿 Traiter (sous fichier .pgm)")
|
| 22 |
+
# label = gr.outputs.Label(num_top_classes=3)
|
| 23 |
|
| 24 |
gr.Interface(
|
| 25 |
+
fn=classify_image,
|
| 26 |
+
inputs=image,
|
| 27 |
+
outputs="text",
|
| 28 |
+
interpretation="default",
|
| 29 |
+
live=True,
|
| 30 |
+
theme="dark-peach",
|
| 31 |
+
title="API BREASTNET de Test de diagnostique du Cancer de Sein",
|
| 32 |
+
description="Cette API est utilis茅 pour dire si le Cancer de sein est Maline ou Pas"
|
| 33 |
).launch()
|