import pickle import pandas as pd import sklearn import numpy as np import gradio as gr import imblearn from app_function import * import tensorflow as tf from tensorflow.keras.applications import imagenet_utils from tensorflow.keras.utils import img_to_array from tensorflow.keras.models import load_model import pdfplumber import re from collections import namedtuple from compress_pickle import dump, load demo = gr.Blocks(theme="peach") with demo: gr.Markdown( """

Healthcare thechnology doctor image

# Machine learning DEMO 🐠 --- """) with gr.Tabs(): with gr.TabItem("Détéction d'une tumeur"): my_input = gr.inputs.Image(shape=(224,224)) vgg16_button = gr.Button("Soumettre") output_html = gr.outputs.HTML(label="") # my_output = gr.Label(label="Resultat de la prédiction",num_top_classes=2) with gr.TabItem("(PDF) Diabétique, prédiabétique ou sain"): # POUR DIABETES FICHIER PDF with gr.Row(): input_file_PDF = gr.File(label='PDF') PDF_diabete_button = gr.Button("Soumettre") df_ouput = gr.Dataframe(label="Caractéristique du patient", headers=["HighBP","HighChol", "CholCheck", "BMI", "Smoker","Stroke","HeartDiseaseorAttack","PhysActivity","Fruits","Veggies","HvyAlcoholConsump","AnyHealthcare", "NoDocbcCost", "GenHlth","MentHlth", "PhysHlth", "DiffWalk","Sex", "Age", "Education","Income"], row_count=1,col_count=(21),max_rows=2,overflow_row_behaviour='paginate') output_html1 = gr.outputs.HTML(label="") # text_output2 = gr.Label(label="Resultat de prédiction",num_top_classes=3) with gr.TabItem("Public- Diabétique, prédiabétique ou sain"): # POUR Diabetes with gr.Row(): with gr.Group(): HighBP = gr.Radio(["Oui","Non"],type="index",label="HighBP") HighChol = gr.Radio(["Oui","Non"],type="index",label="HighChol") CholCheck = gr.Radio(["Oui","Non"],type="index",label="CholCheck") with gr.Group(): Smoker = gr.Radio(["Oui","Non"],type="index",label="Smoker") Stroke = gr.Radio(["Oui","Non"],type="index",label="Stroke") HeartDiseaseorAttack = gr.Radio(["Oui","Non"],type="index",label="HeartDiseaseorAttack") with gr.Group(): PhysActivity = gr.Radio(["Oui","Non"],type="index",label="PhysActivity") Fruits = gr.Radio(["Oui","Non"],type="index",label="Fruits") Veggies = gr.Radio(["Oui","Non"],type="index",label="Veggies") with gr.Group(): HvyAlcoholConsump = gr.Radio(["Oui","Non"],type="index",label="HvyAlcoholConsump") AnyHealthcare = gr.Radio(["Oui","Non"],type="index",label="AnyHealthcare") NoDocbcCost = gr.Radio(["Oui","Non"],type="index",label="NoDocbcCost") with gr.Row(): with gr.Group(): DiffWalk = gr.Radio(["Oui","Non"],type="index",label="DiffWalk") Sex = gr.Dropdown(["femme","homme"],type="index",label="Sex") with gr.Group(): BMI = gr.Slider(12, 98,value=70,label="BMI",step=1) GenHlth = gr.Slider(1, 5,value=2,label="GenHlth",step=1) MentHlth = gr.Slider(0, 30,value=20,label="MentHlth",step=1) with gr.Group(): PhysHlth = gr.Slider(0, 30,value=14,label="PhysHlth",step=1) Age = gr.Slider(1, 13,value=7,label="Age",step=1) with gr.Group(): Education = gr.Slider(1, 6,value=4,label="Education",step=1) Income = gr.Slider(1, 8,value=6,label="Income",step=1) # text_output = gr.Label(num_top_classes=3) Public_diabete_button = gr.Button("Soumettre") input_data = [HighBP,HighChol, CholCheck, BMI, Smoker,Stroke,HeartDiseaseorAttack, PhysActivity, Fruits, Veggies,HvyAlcoholConsump,AnyHealthcare, NoDocbcCost, GenHlth, MentHlth, PhysHlth, DiffWalk, Sex, Age, Education,Income] output_html2 = gr.outputs.HTML(label="") vgg16_button.click(Prediction_VGG16, inputs =my_input,outputs = [output_html]) PDF_diabete_button.click(get_data_inputPDF, inputs=input_file_PDF,outputs=[df_ouput,output_html1]) Public_diabete_button.click(user_input, inputs=input_data,outputs=[output_html2]) gr.Markdown( """

docaposte image

""") demo.launch() #---------------------------------------------------------------------------------------