ElieMark commited on
Commit
504c560
1 Parent(s): 09ff388

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +253 -0
app.py ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import matplotlib.pyplot as plt
4
+ import time
5
+ import numpy as np
6
+ import seaborn as sns
7
+ from streamlit_extras.colored_header import colored_header
8
+ from streamlit_extras.card import card
9
+ from streamlit_extras.badges import badge
10
+ from streamlit_extras.metric_cards import style_metric_cards
11
+ from streamlit_extras.dataframe_explorer import dataframe_explorer ,generate_fake_dataframe
12
+ from streamlit_extras.mention import mention
13
+ from streamlit_extras.chart_container import chart_container
14
+ from streamlit_extras.grid import grid
15
+ from streamlit_extras.row import row
16
+ import pickle
17
+ st.set_page_config(layout="wide", initial_sidebar_state="expanded")
18
+ @st.cache_data
19
+ def LoadDAtaframe():
20
+ return pd.read_csv("concrete.csv")
21
+
22
+ DATA = LoadDAtaframe()
23
+ def displayText1(string):
24
+ for word in string.split(" "):
25
+ yield word+ " "
26
+ time.sleep(0.01)
27
+
28
+ pickled_model = pickle.load(open('modelCiment2.pkl', 'rb'))
29
+
30
+ def SimulateStrength():
31
+ col1,col2 = st.columns(2)
32
+ with col1:
33
+ ciment= st.text_input("Ciment", help="entrez la valeur de la Variable Ciment")
34
+ slag= st.slider("Slag",0.0,300.0,step=0.5)
35
+ ash= st.slider("Ash", 0.0, 200.0, step=0.5)
36
+ water= st.slider("Water", 0,200,step=1)
37
+ with col2:
38
+ superplastic= st.slider("SuperPlastic", 1, 30)
39
+ coarseagg= st.text_input("Coareagg")
40
+ fineagg= st.text_input("FineAgg")
41
+ Age= st.slider("Age", 0,100)
42
+ final= {
43
+ "cement":[int(ciment) if ciment else 0],
44
+ "slag":[float(slag) if slag else 0],
45
+ "ash":[float(ash) if ash else 0],
46
+ "water": [int(water) if water else 0],
47
+ "superplastic":[int(superplastic) if superplastic else 0],
48
+ "coarseagg": [int(coarseagg) if coarseagg else 0],
49
+ "fineagg":[int(fineagg) if fineagg else 0],
50
+ "age":[Age if Age else 0]
51
+ }
52
+ return pd.DataFrame(final, index=[0])
53
+
54
+ Apptitle = "MY CIMENTO "
55
+ MenuNavigation = ["🏠Accueil", "📈Analyse","📊Visualisation", "🤺Simulation", "📞Contact"]
56
+ APPLOGO = "cementoLogo.png"
57
+
58
+ Description= """
59
+ À chaque grand projet de construction, une base solide est essentielle. CIMENTO offre bien plus qu'un simple ciment ; c'est le pilier sur lequel repose votre vision architecturale. Notre ciment est synonyme de qualité inégalée et de fiabilité éprouvée, répondant aux normes les plus strictes de l'industrie.
60
+
61
+ Choisir CIMENTO, c'est investir dans la durabilité et la robustesse. Chaque sac de notre ciment est le résultat d'années d'expertise et d'innovation, garantissant une performance constante et une résistance à toute épreuve face aux défis du temps et des conditions environnementales.
62
+
63
+ Que vous construisiez des maisons, des ponts, des gratte-ciels ou des infrastructures essentielles, notre ciment est votre partenaire de confiance.
64
+ Il renforce les fondations, soutient les structures et assure une construction qui perdure dans le temps.
65
+
66
+ Faites le choix éclairé, optez pour CIMENTO et bâtissez un avenir solide, étape par étape."""
67
+
68
+
69
+ st.sidebar.image(APPLOGO,width=255)
70
+
71
+ myMenu= st.sidebar.selectbox("Où allons 🚔 nous Aujourd'hui? ", MenuNavigation)
72
+
73
+ if myMenu== MenuNavigation[0]:
74
+ st.markdown("<h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'><u>CIMENTO </u></h1>",unsafe_allow_html=True)# affiche des titres html
75
+ st.markdown("<p style='text-align:center; color:gray;'><i>La qualité qui construit l'avenir</i></p>", unsafe_allow_html=True)
76
+ st.markdown("<h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Construisez avec CIMENTO : La Fondation de la Solidité</h1>",unsafe_allow_html=True)# affiche des titres html
77
+ col1,col2= st.columns((1,2))
78
+ with col1:
79
+ st.image("homeCement.jpg")
80
+ with col2:
81
+ st.write(displayText1(Description))
82
+ st.markdown("<h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Les Elements Constitutifs du Ciment</h1>",unsafe_allow_html=True)# affiche des titres html
83
+ c1,c2= st.columns((9,9))
84
+ with c1:
85
+ st.markdown("<h1 style='text-align:center;color: gray; text-transform: uppercase; text-tranform:underline,'>CalCaire</h1>",unsafe_allow_html=True)# affiche des titres html
86
+ cc1,cc2= st.columns((1,2))
87
+ with cc1:
88
+ st.image("calcaire.jpeg", width=255)
89
+ with cc2:
90
+ st.markdown("<p style='margin-left:8%; text-transform: uppercase; text-tranform:underline,'>Le calcaire est la principale source de calcium dans le ciment. Pendant le processus de fabrication, le calcaire réagit avec d'autres composants pour former du silicate de calcium, qui est essentiel à la résistance et à la durabilité du ciment durci. Il contribue également à la réduction de la teneur en alcali du ciment, ce qui aide à prévenir les réactions potentiellement dommageables avec certains minéraux dans les agrégats.</p>",unsafe_allow_html=True)# affiche des titres html
91
+ with c2:
92
+ st.markdown("<h1 style='text-align:center;color: gray; text-transform: uppercase; text-tranform:underline,'>Argile</h1>",unsafe_allow_html=True)# affiche des titres html
93
+ cc1,cc2= st.columns((1,2))
94
+ with cc1:
95
+ st.image("argile.jpeg", width=255)
96
+ with cc2:
97
+ st.markdown("<p style='margin-left:8%; text-transform: uppercase; text-tranform:underline,'> L'argile fournit de la silice, de l'alumine et de l'oxyde de fer au ciment. Ces composants jouent un rôle crucial dans la formation des phases de ciment clé, telles que les silicates et les aluminates, qui contribuent à la résistance et à la prise du ciment. L'argile aide également à ajuster les propriétés de durcissement et à contrôler la température de cuisson pendant la production de clinker.</p>",unsafe_allow_html=True)# affiche des titres html
98
+
99
+ c3,c4= st.columns((9,9))
100
+ with c3:
101
+ st.markdown("<h1 style='text-align:center;color: gray; text-transform: uppercase; text-tranform:underline,'>Gypse (CaSO4·2H2O)</h1>",unsafe_allow_html=True)# affiche des titres html
102
+ cc1,cc2= st.columns((1,2))
103
+ with cc1:
104
+ st.image("gypse.jpeg", width=255)
105
+ with cc2:
106
+ st.markdown("<p style='margin-left:8%; text-transform: uppercase; text-tranform:underline,'> Le gypse est ajouté au ciment pour réguler le processus de durcissement. Il agit comme un retardateur de prise, ralentissant la réaction chimique entre l'eau et le ciment. Cela permet de manipuler le temps de prise du ciment et d'optimiser sa résistance finale. Le gypse contribue également à améliorer la maniabilité du ciment frais lorsqu'il est mélangé avec de l'eau.</p>",unsafe_allow_html=True)# affiche des titres html
107
+ with c4:
108
+ st.markdown("<h3 style='text-align:center;color: gray; text-transform: uppercase; text-tranform:underline,'>Minéraux secondaires (comme les oxydes de fer et d'aluminium)</h3>",unsafe_allow_html=True)# affiche des titres html
109
+ cc1,cc2= st.columns((1,2))
110
+ with cc1:
111
+ st.image("oxydefer.jpeg", width=255)
112
+ with cc2:
113
+ st.markdown("<p style='margin-left:8%; text-transform: uppercase; text-tranform:underline,'> L'argile fournit de la silice, de l'alumine et de l'oxyde de fer au ciment. Ces composants jouent un rôle crucial dans la formation des phases de ciment clé, telles que les silicates et les aluminates, qui contribuent à la résistance et à la prise du ciment. L'argile aide également à ajuster les propriétés de durcissement et à contrôler la température de cuisson pendant la production de clinker.</p>",unsafe_allow_html=True)# affiche des titres html
114
+
115
+ elif myMenu==MenuNavigation[4]:
116
+ st.markdown("<h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Mon Profil</h1>",unsafe_allow_html=True)# affiche des titres html
117
+ col1, col2= st.columns((6,15))
118
+ with col1:
119
+ st.image("minee.jpg", width=385)
120
+
121
+ with col2:
122
+ cols1,cols2= st.columns((1,1))
123
+ st.markdown("""
124
+ <div style='display:flex; flex-direction:row;'>
125
+ <h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Nom:</h1>
126
+ <h1 style='text-align:left;color: gray; text-transform: uppercase; text-tranform:underline,'>Elie Makoda Kowo</h1>
127
+ </div>
128
+ """,unsafe_allow_html=True)
129
+ st.markdown("""
130
+ <div style='display:flex; flex-direction:row;'>
131
+ <h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Email:</h1>
132
+ <h1 style='text-align:left;color: gray; text-tranform:underline,'><a href='mailto:eliemakodakowo@gmail.com' style='color:gray;'> eliemakodakowo@gmail.com</a></h1>
133
+ </div>
134
+ """,unsafe_allow_html=True)
135
+ st.markdown("""
136
+ <div style='display:flex; flex-direction:row;'>
137
+ <h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Contact:</h1>
138
+ <h1 style='text-align:left;color: gray; text-tranform:underline,'><a href='tel:+237 698982479' style='color:gray;'>+237 674349356 / +237 698982479</a></h1>
139
+ </div>
140
+ """,unsafe_allow_html=True)
141
+
142
+ st.markdown("""
143
+ <div style='display:flex; flex-direction:row;'>
144
+ <h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>Level:</h1>
145
+ <h1 style='text-align:left;color: gray; text-tranform:underline,'>Bachelor 3 Artificial Intelligence & Big Data</h1>
146
+ </div>
147
+ """,unsafe_allow_html=True)
148
+ st.markdown("<h1 style='color: #005580; text-align:center; text-transform: uppercase; text-tranform:underline,'>Competences</h1>",unsafe_allow_html=True)# affiche des titres html
149
+ coll1, coll2, coll3=st.columns((6,5,4))
150
+ with coll1:
151
+ card(
152
+ title="Programmation Web",
153
+ text="React , Django, Spring , Php",
154
+ url="https://github.com/eliemakoda?tab=repositories",
155
+ )
156
+ with coll2:
157
+ card(
158
+ title="Programmation DeskTop",
159
+ text="Java, C_Sharp",
160
+ url="https://github.com/eliemakoda?tab=repositories",
161
+ )
162
+ with coll3:
163
+ card(
164
+ title="Programmation Mobile",
165
+ text="React Native ",
166
+ url="https://github.com/eliemakoda?tab=repositories",
167
+ )
168
+ colls1, colls2=st.columns((8,8))
169
+ with colls1:
170
+ card(
171
+ title="Machine & Deep Learning",
172
+ text="Tensorflow ,Pycaret, Sklearn, ProphetNeural... ",
173
+ url="https://github.com/eliemakoda?tab=repositories",
174
+ )
175
+ with colls2:
176
+ card(
177
+ title="Data Analysis",
178
+ text="Seaborn , Tableau , PowerBi , Matplotlib, Numpy Pandas... ",
179
+ url="https://github.com/eliemakoda?tab=repositories",
180
+ )
181
+
182
+ elif myMenu== MenuNavigation[1]:
183
+ col1, col2, col3, col4 ,col5= st.columns(5)
184
+ col1.metric(label="Nombre Ciment", value=DATA.shape[0], delta=1000)
185
+ col2.metric(label="AGE MOYEN", value=int(DATA.age.sum()/DATA.shape[0]), delta=100)
186
+ col3.metric(label="Max Ciment Strength", value=max(DATA.strength), delta=100)
187
+ col4.metric(label="Taux d'eau MOYEN", value=int(DATA.water.sum()/DATA.shape[0]), delta=-200)
188
+ col5.metric(label="Force Moyenne Ciment", value=int(DATA.strength.sum()/DATA.shape[0]), delta=82)
189
+
190
+ st.title("Filtrez le Dataframe ici ")
191
+ style_metric_cards()
192
+ dataframe = DATA
193
+ filtered_df = dataframe_explorer(dataframe, case=False)
194
+ st.dataframe(filtered_df, use_container_width=True)
195
+ mention(
196
+ label="Vue Statistique du jeu de données",
197
+ # icon="streamlit", # Some icons are available... like Streamlit!
198
+ url="#",
199
+ )
200
+ with chart_container(DATA):
201
+ st.write("Here's a cool chart")
202
+ st.area_chart(DATA)
203
+
204
+ elif myMenu== MenuNavigation[2]:
205
+ st.markdown("<h1 style='text-align:center;color: gray; text-transform: uppercase; text-tranform:underline,'>Observons Nos données Avec les Graphes</h1>",unsafe_allow_html=True)# affiche des titres html
206
+ my_grid = grid(2, [2, 4, 1], 1, 4, vertical_align="bottom")
207
+
208
+ # Row 1:
209
+ # my_grid.dataframe(DATA, use_container_width=True)
210
+ my_grid.line_chart(DATA.drop(["slag","ash", "superplastic","strength","age"], axis=1), use_container_width=True)
211
+
212
+ my_grid.line_chart(DATA[["age", "strength"]], use_container_width=True)
213
+ col1, col2= st.columns(2)
214
+ with col1:
215
+ st.write(DATA.describe())
216
+ with col2:
217
+ mask = np.triu(np.ones_like(DATA.corr(), dtype=bool))
218
+ f, ax = plt.subplots(figsize=(3,4))
219
+ cmap = sns.diverging_palette(230, 20, as_cmap=True)
220
+ sns.heatmap(DATA.corr(), mask=mask, cmap=cmap, vmax=.2, center=0,
221
+ square=True, linewidths=.3, cbar_kws={"shrink": .4})
222
+ st.pyplot(f, use_container_width=False)
223
+ elif myMenu== MenuNavigation[3]:
224
+ st.markdown("<h1 style='text-align:center;color: #005580; text-transform: uppercase; text-tranform:underline,'>SIMULATION DE LA FORCE DE VOTRE CIMENT</h1>",unsafe_allow_html=True)# affiche des titres html
225
+ file= st.sidebar.file_uploader("Importez un fichier de Prediction ")
226
+ if file:
227
+ dat= pd.read_csv(file)
228
+ dat["strength"]= pickled_model.predict(dat)
229
+ with chart_container(dat):
230
+ st.write("Hello Un Graphe ")
231
+ st.area_chart(dat.drop(["slag","ash", "superplastic","strength","age"],axis=1))
232
+ elif st.sidebar.checkbox("Utiliser Notre Fichier"):
233
+ dat= pd.read_csv("test.csv")
234
+ dat["strength"]= pickled_model.predict(dat)
235
+ with chart_container(dat):
236
+ st.write("Hello Un Graphe ")
237
+ st.area_chart(dat)
238
+ else:
239
+ custDat= SimulateStrength()
240
+ col1,col2= st.columns(2)
241
+
242
+ with col1:
243
+ st.write(custDat)
244
+ with col2:
245
+ result = round(pickled_model.predict(custDat)[0],2)
246
+ if result>=35:
247
+ st.write(displayText1("Bravo! Votre Ciment est très Solide et de Très bonne Qualité "))
248
+ st.success(result)
249
+ st.image("beton.jpeg", width=400)
250
+ else:
251
+ st.write("Attention! Votre Ciment est faible Voire de Mauvaise qualité")
252
+ st.error(result)
253
+ st.image("bad.jpeg", width=400)