notjulietxd commited on
Commit
e5e5e62
·
verified ·
1 Parent(s): c5f8b66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -19,25 +19,26 @@ poly = PolynomialFeatures(degree=5, include_bias=False)
19
  scaler = StandardScaler()
20
 
21
  #
22
- def preprocess_input(flange_width, beam_width, geometric_factor):
23
  """
24
  Preprocess the input data: apply polynomial features and then scale.
25
  """
26
 
27
  # # Apply Polynomial Features
28
- X_test_poly = poly_loaded.transform([[flange_width, beam_width, geometric_factor]])
 
29
 
30
  # Standardize the polynomial features
31
  scaled_features = scaler_loaded.transform(X_test_poly)
32
 
33
  return scaled_features
34
 
35
- def predict_fatigue_crack_growth_rate(flange_width, beam_width, geometric_factor):
36
  """
37
  Function to predict the fatigue crack growth rate based on the preprocessed input features.
38
  """
39
  # Preprocess the input data
40
- preprocessed_input = preprocess_input(flange_width, beam_width, geometric_factor)
41
 
42
  # Predict using the loaded model
43
  prediction = model.predict(preprocessed_input)
@@ -47,12 +48,14 @@ def predict_fatigue_crack_growth_rate(flange_width, beam_width, geometric_factor
47
 
48
  # Create a Gradio interface
49
  iface = gr.Interface(fn=predict_fatigue_crack_growth_rate,
50
- inputs=[gr.Number(label="Column Width"),
 
51
  gr.Number(label="Beam Width"),
52
- gr.Number(label="Geometric Factor")],
 
53
  outputs=gr.Textbox(label="Prediction"),
54
  title="Fatigue Crack Growth Rate Predictor",
55
- description="Enter the values for Column Width, Beam Width, and Geometric Factor to predict the Fatigue Crack Growth Rate.")
56
 
57
  if __name__ == "__main__":
58
  iface.launch()
 
19
  scaler = StandardScaler()
20
 
21
  #
22
+ def preprocess_input(eometric_factor, flange_width, beam_width, beamh, columntw):
23
  """
24
  Preprocess the input data: apply polynomial features and then scale.
25
  """
26
 
27
  # # Apply Polynomial Features
28
+ # ['GEOMETRIC_FACTOR', 'COLUMN_WIDTH', 'BEAM_WIDTH','BEAM - h', 'COLUMN - tw']
29
+ X_test_poly = poly_loaded.transform([[eometric_factor, flange_width, beam_width, beamh, columntw]])
30
 
31
  # Standardize the polynomial features
32
  scaled_features = scaler_loaded.transform(X_test_poly)
33
 
34
  return scaled_features
35
 
36
+ def predict_fatigue_crack_growth_rate(geometric_factor, flange_width, beam_width, beamh, columntw):
37
  """
38
  Function to predict the fatigue crack growth rate based on the preprocessed input features.
39
  """
40
  # Preprocess the input data
41
+ preprocessed_input = preprocess_input(eometric_factor, flange_width, beam_width, beamh, columntw)
42
 
43
  # Predict using the loaded model
44
  prediction = model.predict(preprocessed_input)
 
48
 
49
  # Create a Gradio interface
50
  iface = gr.Interface(fn=predict_fatigue_crack_growth_rate,
51
+ inputs=[gr.Number(label="Geometric Factor")],
52
+ gr.Number(label="Column Width"),
53
  gr.Number(label="Beam Width"),
54
+ gr.Number(label="Beam - h"),
55
+ gr.Number(label="Column - tw"),
56
  outputs=gr.Textbox(label="Prediction"),
57
  title="Fatigue Crack Growth Rate Predictor",
58
+ description="Enter the values for Geometric Factor, Column Width, Beam Width, Beam - h, and COLUMN - tw to predict the Fatigue Crack Growth Rate.")
59
 
60
  if __name__ == "__main__":
61
  iface.launch()