Sidoine commited on
Commit
c7d926f
·
1 Parent(s): d2f47ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -28
app.py CHANGED
@@ -7,37 +7,53 @@ from tensorflow.keras.utils import load_img,img_to_array
7
  from tensorflow.keras.preprocessing import image
8
  from PIL import Image,ImageOps
9
 
 
10
 
11
- #Donner un titre
12
- st.title(":red[APPLICATION DE PREDICTION DU COVID] :bar_chart: :chart:")
13
- st.markdown("* NOM: FOSSO TCHATAT SIDOINE ",unsafe_allow_html=True)
14
 
15
- #loader l'image
16
- st.image("keyce.jpg")
17
 
18
- upload_file = st.file_uploader("Telecharger un fichier",type = ['JPEG','jpg','png','PNG'])
 
 
19
 
20
-
21
- model = tf.keras.models.load_model("model.h5")
22
- covid_classes = {'COVID19': 0, 'NORMAL': 1, 'PNEUMONIA': 2, 'TURBERCULOSIS': 3}
23
- tab1, tab2= st.tabs([":bar_chart: Evaluation du model", ":mask: :smile: Prediction"])
24
-
25
- with tab1:
26
- st.image("loss.png")
27
- with tab2:
28
- generate_pred = st.button("Predict")
29
- if upload_file:
30
- st.image(upload_file,caption="Image téléchargée",use_column_width=True)
31
- test_image = image.load_img(upload_file,target_size=(299,299))
32
- image_array = img_to_array(test_image)
33
- image_array = np.expand_dims(image_array,axis=0)
34
-
35
- if generate_pred:
36
- predictions = model.predict(image_array)
37
- classes = np.argmax(predictions[0])
38
- for key,value in covid_classes.items():
39
- if value == classes:
40
- st.write("The diagostic is :",key)
41
-
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
 
7
  from tensorflow.keras.preprocessing import image
8
  from PIL import Image,ImageOps
9
 
10
+ st.sidebar.image("image/keyce.jpg")
11
 
12
+ menu_options = ["Documentation", "Application"]
 
 
13
 
14
+ selection = st.sidebar.selectbox("Sélectionnez une page", menu_options)
 
15
 
16
+ if selection == "Docummentation":
17
+ st.title("Bienvenue sur la documentation")
18
+ st.write("L'application de surveillance médicale pour COVID, Pneumonie et Tuberculose est un outil interactif conçu pour aider les professionnels de la santé à suivre et analyser les cas de ces maladies respiratoires. L'application fournit des fonctionnalités permettant de visualiser les données, d'effectuer des analyses approfondies et de prendre des décisions éclairées.")
19
 
20
+ elif selection == "Application":
21
+ def main():
22
+
23
+ st.title(":red[APPLICATION DE PREDICTION DU COVID] :bar_chart: :chart:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
+ st.markdown("* NOM: FOSSO TCHATAT SIDOINE ",unsafe_allow_html=True)
26
+
27
+ model = tf.keras.models.load_model("model.h5")
28
+ covid_classes = {'COVID19': 0, 'NORMAL': 1, 'PNEUMONIA': 2, 'TURBERCULOSIS': 3}
29
+ tab1, tab2,tab3= st.tabs(["Uploader le fichier",":bar_chart: Evaluation du model", ":mask: :smile: Prediction"])
30
+
31
+ with tab1:
32
+ upload_file = st.file_uploader("Telecharger un fichier",type = ['JPEG','jpg','png','PNG'])
33
+ with tab2:
34
+ st.image("image/loss.png")
35
+ with tab3:
36
+
37
+ if upload_file:
38
+ st.image(upload_file,caption="Image téléchargée",use_column_width=True)
39
+ test_image = image.load_img(upload_file,target_size=(299,299))
40
+ image_array = img_to_array(test_image)
41
+ image_array = np.expand_dims(image_array,axis=0)
42
+
43
+ #Boutton pour effectuer la prédiction
44
+ btn_prediction = st.button("Effectuer le diagnostic")
45
+
46
+ if btn_prediction:
47
+ predictions = model.predict(image_array)
48
+ classes = np.argmax(predictions[0])
49
+
50
+ for cle, valeur in covid_classes.items():
51
+ if valeur == classes:
52
+ st.write("The diagostic is :",cle)
53
+
54
+ #Donner un titre
55
+
56
+ if __name__ == '__main__':
57
+ main()
58
+
59