CirConStr1 / app.py
Concrete123's picture
Update app.py
a273690
raw
history blame
1.2 kB
import numpy as np
import pandas as pd
import pandas as pd
df_strength=pd.read_csv("data_strength.csv")
import random
x_strength=df_strength.iloc[:,:-1]
y_strength=df_strength.iloc[:,-1]
clf = XGBRegressor(learning_rate=0.1788, max_depth=27, subsample=0.5146, n_estimators=100)
clf.fit(x_strength, y_strength)
import gradio as gr
def CirConStr(d, s, fyv, psv, fc):
# Turning the arguments into a numpy array
x = np.array([d, s, fyv, psv, fc])
prediction = clf.predict(x.reshape(1, -1))
return prediction
inputs = [
gr.inputs.Number(label="Diameter of spiral stirrups (d, unit: mm)"),
gr.inputs.Number(label="Spacing of stirrups (s, unit: mm)"),
gr.inputs.Number(label="Yield strength of spiral stirrups (fyv, unit: MPa)"),
gr.inputs.Number(label="Volumetric ratio of spiral stirrups(psv, unit: %)"),
gr.inputs.Number(label="Compressive strength of concrete (fc, unit: MPa)")
]
outputs = gr.outputs.Textbox(label="Estimated Compressive Strength (fcc, unit: MPa)")
app = gr.Interface(fn=CirConStr, inputs=inputs, outputs=outputs, description="Compressive strength estimation for circular concrete column confined by spiral stirrups")
app.launch(share=True)