File size: 1,029 Bytes
7c0aa32 6e85977 7c0aa32 6e85977 7c0aa32 6e85977 7c0aa32 6e85977 7c0aa32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
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()
|