ZELEFACK commited on
Commit
b312c9e
1 Parent(s): 36ce682

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()