Spaces:
Build error
Build error
File size: 1,866 Bytes
f486a3c d697ea8 f486a3c 47ac3a1 9246fc1 f486a3c 69b351b 06c9e4d 69b351b 47ac3a1 69b351b e25c692 47ac3a1 f486a3c 5da375a 1ebbe12 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
import numpy as np
import pandas as pd
import xgboost as xgb
import pandas as pd
import random
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split,cross_val_score
from sklearn.ensemble import RandomForestClassifier,RandomForestRegressor
from sklearn.metrics import classification_report,confusion_matrix,accuracy_score
from sklearn.neighbors import KNeighborsClassifier,KNeighborsRegressor
from sklearn.svm import SVC,SVR
from sklearn import datasets
df_strength=pd.read_csv("data_strength11.csv")
import random
x_strength=df_strength.iloc[:,:-1]
y_strength=df_strength.iloc[:,-1]
x_strength=df_strength.iloc[:,:-1]
y_strength=df_strength.iloc[:,-1]
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test=train_test_split(x_strength,y_strength, test_size=0.15, random_state=2)
clf = xgb.XGBRegressor(learning_rate=0.1788, max_depth=27, subsample=0.5146, n_estimators=100,seed = 40)
clf.fit(x_train, y_train)
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() |