BreastNet / app.py
ZELEFACK's picture
Update app.py
6e85977
raw history blame
No virus
1.03 kB
import gradio as gr
import tensorflow as tf
import numpy as np
import cv2
new_model = tf.keras.models.load_model('best_model_mammography.h5')
def classify_image(file_name):
img1 = cv2.imread(file_name.name.replace("\\",'/'),0)
img = cv2.resize(img1, (224,224))
img = img.reshape(img.shape[0],img.shape[1],1)
pred = new_model.predict(np.array([img]))
pred = np.round(pred,1)
if pred == 0:
pred = "V么tre cancer est Begnine"
else:
pred= "V么tre cancer est maline"
return pred
image = gr.inputs.File( file_count="single",type="file", label="Fichier 脿 Traiter (sous fichier .pgm)")
# label = gr.outputs.Label(num_top_classes=3)
gr.Interface(
fn=classify_image,
inputs=image,
outputs="text",
interpretation="default",
live=True,
theme="dark-peach",
title="API BREASTNET de Test de diagnostique du Cancer de Sein",
description="Cette API est utilis茅 pour dire si le Cancer de sein est Maline ou Pas"
).launch()