jithenderchoudary commited on
Commit
8218aa6
·
verified ·
1 Parent(s): 2e82610

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -14
app.py CHANGED
@@ -10,36 +10,23 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
10
  # Import optimization logic
11
  from models.optimizer import optimize_design
12
 
13
-
14
  # Load pre-trained model
15
  def load_model():
16
- """
17
- Load the pre-trained defect prediction model from the models directory.
18
- """
19
  with open("models/defect_model.pkl", "rb") as file:
20
  model = pickle.load(file)
21
  return model
22
 
23
-
24
  # Predict defects using the loaded model
25
  def predict_defects(model, data):
26
- """
27
- Predict defect types based on input data using the pre-trained model.
28
- """
29
  predictions = model.predict(data)
30
  return predictions
31
 
32
-
33
  def main():
34
- """
35
- Main Streamlit web app for defect prediction and design optimization.
36
- """
37
  st.title("Press Tool AI: Defect Prediction and Optimization")
38
 
39
  # File upload
40
  uploaded_file = st.file_uploader("Upload Design Parameters (CSV)", type="csv")
41
  if uploaded_file:
42
- # Load uploaded CSV data
43
  data = pd.read_csv(uploaded_file)
44
  st.write("Uploaded Data:")
45
  st.dataframe(data)
@@ -66,6 +53,5 @@ def main():
66
  mime="text/csv",
67
  )
68
 
69
-
70
  if __name__ == "__main__":
71
  main()
 
10
  # Import optimization logic
11
  from models.optimizer import optimize_design
12
 
 
13
  # Load pre-trained model
14
  def load_model():
 
 
 
15
  with open("models/defect_model.pkl", "rb") as file:
16
  model = pickle.load(file)
17
  return model
18
 
 
19
  # Predict defects using the loaded model
20
  def predict_defects(model, data):
 
 
 
21
  predictions = model.predict(data)
22
  return predictions
23
 
 
24
  def main():
 
 
 
25
  st.title("Press Tool AI: Defect Prediction and Optimization")
26
 
27
  # File upload
28
  uploaded_file = st.file_uploader("Upload Design Parameters (CSV)", type="csv")
29
  if uploaded_file:
 
30
  data = pd.read_csv(uploaded_file)
31
  st.write("Uploaded Data:")
32
  st.dataframe(data)
 
53
  mime="text/csv",
54
  )
55
 
 
56
  if __name__ == "__main__":
57
  main()