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()