Spaces:
Sleeping
Sleeping
#Importer les librairies | |
import streamlit as st | |
import tensorflow as tf | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from tensorflow.keras.utils import load_img,img_to_array | |
from tensorflow.keras.preprocessing import image | |
from PIL import Image,ImageOps | |
#Donner un titre | |
st.title(":red[APPLICATION DE PREDICTION DU COVID] :bar_chart: :chart:") | |
st.markdown("* NOM: FOSSO TCHATAT SIDOINE ",unsafe_allow_html=True) | |
#loader l'image | |
st.image("image/keyce.jpg") | |
upload_file = st.file_uploader("Telecharger un fichier",type = ['JPEG','jpg','png','PNG']) | |
model = tf.keras.models.load_model("model.h5") | |
covid_classes = {'COVID19': 0, 'NORMAL': 1, 'PNEUMONIA': 2, 'TURBERCULOSIS': 3} | |
tab1, tab2= st.tabs([":bar_chart: Evaluation du model", ":mask: :smile: Prediction"]) | |
with tab1: | |
st.image("image/loss.png") | |
with tab2: | |
generate_pred = st.button("Predict") | |
if upload_file: | |
st.image(upload_file,caption="Image téléchargée",use_column_width=True) | |
test_image = image.load_img(upload_file,target_size=(299,299)) | |
image_array = img_to_array(test_image) | |
image_array = np.expand_dims(image_array,axis=0) | |
if generate_pred: | |
predictions = model.predict(image_array) | |
classes = np.argmax(predictions[0]) | |
for key,value in covid_classes.items(): | |
if value == classes: | |
st.write("The diagostic is :",key) | |