Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,7 @@ model = load_model('crack_prediction-2.h5')
|
|
| 11 |
poly = PolynomialFeatures(degree=5, include_bias=False)
|
| 12 |
scaler = StandardScaler()
|
| 13 |
|
|
|
|
| 14 |
def preprocess_input(flange_width, beam_width, geometric_factor):
|
| 15 |
"""
|
| 16 |
Preprocess the input data: apply polynomial features and then scale.
|
|
@@ -19,11 +20,12 @@ def preprocess_input(flange_width, beam_width, geometric_factor):
|
|
| 19 |
input_data = np.reshape( [flange_width, beam_width, geometric_factor], (1,-1))
|
| 20 |
|
| 21 |
# # Apply Polynomial Features
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
#
|
| 26 |
-
|
|
|
|
| 27 |
scaled_features = scaler.transform(X_train_poly_scaled)
|
| 28 |
|
| 29 |
return scaled_features
|
|
|
|
| 11 |
poly = PolynomialFeatures(degree=5, include_bias=False)
|
| 12 |
scaler = StandardScaler()
|
| 13 |
|
| 14 |
+
#
|
| 15 |
def preprocess_input(flange_width, beam_width, geometric_factor):
|
| 16 |
"""
|
| 17 |
Preprocess the input data: apply polynomial features and then scale.
|
|
|
|
| 20 |
input_data = np.reshape( [flange_width, beam_width, geometric_factor], (1,-1))
|
| 21 |
|
| 22 |
# # Apply Polynomial Features
|
| 23 |
+
poly = PolynomialFeatures(degree=5, include_bias=False)
|
| 24 |
+
X_test_poly = poly.fit_transform(input_data)
|
| 25 |
+
|
| 26 |
+
# Standardize the polynomial features
|
| 27 |
+
scaler = StandardScaler()
|
| 28 |
+
X_train_poly_scaled = scaler.fit_transform(X_test_poly)
|
| 29 |
scaled_features = scaler.transform(X_train_poly_scaled)
|
| 30 |
|
| 31 |
return scaled_features
|