Commit
•
5ddba10
1
Parent(s):
eb57ace
Upload 4 files
Browse files- app.py +48 -0
- modelCO2.pkl +3 -0
- modelCS.pkl +3 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import joblib
|
3 |
+
from PIL import Image
|
4 |
+
|
5 |
+
# Load already saved pipelines
|
6 |
+
best_model_cs = joblib.load("modelCS.pkl")
|
7 |
+
best_model_co2 = joblib.load("modelCO2.pkl")
|
8 |
+
|
9 |
+
# Prediction function for compressive strength model
|
10 |
+
def make_prediction(Fly_ash, GGBS_GGBFS, Fine_aggregate, Na2SiO3_solution, NaOH_solution, NaOH_concentration, Superplasticiser, Curing_temperature, Curing_Period, Testing_Age):
|
11 |
+
predt_cs = best_model_cs.predict([[Fly_ash, GGBS_GGBFS, Fine_aggregate, Na2SiO3_solution, NaOH_solution, NaOH_concentration, Superplasticiser, Curing_temperature, Curing_Period, Testing_Age]])
|
12 |
+
predt_co2 = best_model_co2.predict([[Fly_ash, GGBS_GGBFS, Fine_aggregate, Na2SiO3_solution, NaOH_solution, NaOH_concentration, Superplasticiser, Curing_temperature, Curing_Period, Testing_Age]])
|
13 |
+
value_cs = round(predt_cs[0], 3)
|
14 |
+
value_co2 = round(predt_co2[0], 3)
|
15 |
+
image_component = gr.Image("/Users/mohamedrabie/Library/CloudStorage/OneDrive-UniversityofWestLondon/University/Course/PhD/Research/PhD work/ML/Research work/Geopolymer mortar with ML/ML models and data/Models/MOO/MOO results.png", label="multi-objective optimization", type="pil")
|
16 |
+
return value_cs, value_co2, image_component,
|
17 |
+
|
18 |
+
# Inputs for the models
|
19 |
+
inputs = [
|
20 |
+
gr.Slider(0, 961.0, label='Fly ash (Kg/m³)', info="Amount of Fly ash (Kg/m³)"),
|
21 |
+
gr.Slider(0, 711.0, label='GGBS or GGBFS (Kg/m³)', info="Amount of Ground Granulated Blast Furnace Slag(Kg/m³)"),
|
22 |
+
gr.Slider(0, 1956.0, label='Fine aggregate (Kg/m³)', info="Amount of Fine aggregate (Kg/m³)"),
|
23 |
+
gr.Slider(0, 531.0, label='Na₂SiO₃ solution (Kg/m³)', info="Amount of Sodium Silicate solution (Kg/m³)"),
|
24 |
+
gr.Slider(0, 284.44, label='NaOH solution (Kg/m³)', info="Amount of Sodium Hydroxide solution (Kg/m³)"),
|
25 |
+
gr.Slider(0, 16.0, label='NaOH concentration (M)', info="Sodium Hydroxide concentration (M)"),
|
26 |
+
gr.Slider(0, 35.555, label='Superplasticiser (kg/m³)', info="Amount of Superplasticiser (kg/m³)"),
|
27 |
+
gr.Slider(-7.5, 800.0, label='Curing temperature (°C)'),
|
28 |
+
gr.Slider(1, 180, label='Curing Period (days)'),
|
29 |
+
gr.Slider(1, 180, label='Testing Age (days)'),
|
30 |
+
]
|
31 |
+
|
32 |
+
# Outputs for both models
|
33 |
+
outputs = [
|
34 |
+
gr.Textbox(label="Compressive strength (MPa)"),
|
35 |
+
gr.Textbox(label="CO₂ footprint (Kg/m³)"),
|
36 |
+
gr.Image(label="multi-objective optimization for geopolymer mortar"),
|
37 |
+
]
|
38 |
+
|
39 |
+
# Create one interface for both models
|
40 |
+
app = gr.Interface(
|
41 |
+
fn=make_prediction,
|
42 |
+
inputs=inputs,
|
43 |
+
outputs=outputs,
|
44 |
+
title="Alkali-Activated Mortar Compressive Strength Prediction Using Machine Learning with Multi-objective Optimization",
|
45 |
+
description="Developed by Mohamed Rabieᵃ, Mohamed Aminᵇ, Usama Ebeadᵇ and Ibrahim Shaabanᵃ\n\nᵃUniversity of West London\n\nᵇQatar University \n\nContact: (mohamed.rabie@uwl.ac.uk ; mohamedrabie26@gmail.com)\n\nUse the sliders below to insert mix design quantity and click the submit button to make your prediction."
|
46 |
+
)
|
47 |
+
|
48 |
+
app.launch(share=False)
|
modelCO2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:05b5e70c90b47408ad358dff8251de7c7ade4016af461ff54df4e08fe4323a1b
|
3 |
+
size 2340625
|
modelCS.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a2bf63f525af3b1f9fa7a67044ae696bc2caf0d8159fdb73d0c7c53c25e0ca9b
|
3 |
+
size 7526317
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
joblib
|
2 |
+
scikit-learn==1.3.2
|
3 |
+
gradio
|