Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,34 +36,19 @@ clf.fit(x_train, y_train)
|
|
| 36 |
|
| 37 |
|
| 38 |
import gradio as gr
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
def OPS_LWAC(OPC, SCM_FA, SCM_SF, w_b, FA, CA, OPS, SP, T):
|
| 48 |
# Turning the arguments into a numpy array
|
| 49 |
x = np.array([OPC, SCM_FA, SCM_SF, w_b, FA, CA, OPS, SP, T])
|
| 50 |
prediction = clf.pred_dist(x.reshape(1, -1))
|
| 51 |
aa=prediction.params["loc"].item()
|
|
|
|
| 52 |
bb=prediction.params["scale"].item()
|
| 53 |
-
|
| 54 |
-
#
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
plt.ylabel('Probability Density')
|
| 60 |
-
plt.title('Probability Density Curve for Compressive Strength')
|
| 61 |
-
plt.grid(True)
|
| 62 |
-
plt.legend()
|
| 63 |
-
plt.savefig('probability_density_curve.png')
|
| 64 |
-
|
| 65 |
-
result_string = "[CS: {:.2f}; σ: {:.2f}]".format(aa, bb)
|
| 66 |
-
return result_string, "probability_density_curve.png"
|
| 67 |
|
| 68 |
inputs = [
|
| 69 |
gr.inputs.Number(label="cement content (OPC, unit: kg/m3)"),
|
|
@@ -76,10 +61,7 @@ inputs = [
|
|
| 76 |
gr.inputs.Number(label="superplasticizer content (SP, unit: kg/m3)"),
|
| 77 |
gr.inputs.Number(label="curing time (T, unit: d)")
|
| 78 |
]
|
| 79 |
-
outputs =
|
| 80 |
-
gr.outputs.Textbox(label="Estimated mean prediction and σ value (unit: MPa)"),
|
| 81 |
-
gr.outputs.Image(label="Probability Density Curve")
|
| 82 |
-
]
|
| 83 |
|
| 84 |
app = gr.Interface(fn=OPS_LWAC, inputs=inputs, outputs=outputs, description="Estimation of compressive strength of OPS-based lightweight concrete")
|
| 85 |
app.launch()
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
def OPS_LWAC(OPC, SCM_FA, SCM_SF, w_b, FA, CA, OPS, SP, T):
|
| 40 |
# Turning the arguments into a numpy array
|
| 41 |
x = np.array([OPC, SCM_FA, SCM_SF, w_b, FA, CA, OPS, SP, T])
|
| 42 |
prediction = clf.pred_dist(x.reshape(1, -1))
|
| 43 |
aa=prediction.params["loc"].item()
|
| 44 |
+
#value1 = aa[0]
|
| 45 |
bb=prediction.params["scale"].item()
|
| 46 |
+
#value2 = bb[0]
|
| 47 |
+
#prediction = clf.predict(x.reshape(1, -1))
|
| 48 |
+
#-3*y_dists.params["scale"]+y_dists.params["loc"]
|
| 49 |
+
result_string = "[CS: {:.3f}; σ: {:.3f}]".format(aa, bb)
|
| 50 |
+
return result_string
|
| 51 |
+
#return [aa, bb]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
inputs = [
|
| 54 |
gr.inputs.Number(label="cement content (OPC, unit: kg/m3)"),
|
|
|
|
| 61 |
gr.inputs.Number(label="superplasticizer content (SP, unit: kg/m3)"),
|
| 62 |
gr.inputs.Number(label="curing time (T, unit: d)")
|
| 63 |
]
|
| 64 |
+
outputs = gr.outputs.Textbox(label="Estimated mean prediction and σ value (unit: MPa)")
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
app = gr.Interface(fn=OPS_LWAC, inputs=inputs, outputs=outputs, description="Estimation of compressive strength of OPS-based lightweight concrete")
|
| 67 |
app.launch()
|