samridh12 commited on
Commit
b3066ec
1 Parent(s): f095f3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -2,10 +2,10 @@ import streamlit as st
2
  import pandas as pd
3
  import pickle
4
  import os
5
- from database import create_connection, insert_data
6
 
7
  # Database setup
8
- conn = create_connection('example_db') # Assuming this function is correctly defined in database.py
9
 
10
  # Load the trained models
11
  current_dir = os.path.dirname(os.path.abspath(__file__))
@@ -172,21 +172,23 @@ with tabs[4]:
172
 
173
  # Insert supplier data
174
  supplier_data = pd.DataFrame({
175
- 'Part No': [part_no],
176
- 'Process Type': [process_type],
177
- 'Part OD': [part_od],
178
- 'Part ID': [part_id],
179
- 'Part Width': [part_width],
180
- 'Finish Wt': [finish_wt],
181
- 'Grade Type': [grade_type],
182
- 'Material ID': [material_id],
183
- 'Predicted Input Weight': [predicted_input_weight],
184
- 'Raw Material Cost': [raw_material_cost],
185
- 'Process Cost': [process_cost],
186
- 'Machining Cost': [machining_cost],
187
- 'Scrap Recovery': [scrap_recovery],
188
- 'Inspection Cost': [inspection_cost],
189
- 'Total Manufacturing Cost': [total_mg_cost]
 
 
190
  })
191
  insert_data(conn, 'supplier_data', supplier_data)
192
  st.success("Supplier data added successfully")
 
2
  import pandas as pd
3
  import pickle
4
  import os
5
+ from database import create_connection, insert_data, fetch_data
6
 
7
  # Database setup
8
+ conn = create_connection('example_db') # Adjust the name 'example_db' as necessary
9
 
10
  # Load the trained models
11
  current_dir = os.path.dirname(os.path.abspath(__file__))
 
172
 
173
  # Insert supplier data
174
  supplier_data = pd.DataFrame({
175
+ 'part_no': [part_no],
176
+ 'process_type': [process_type],
177
+ 'part_od': [part_od],
178
+ 'part_id': [part_id],
179
+ 'part_width': [part_width],
180
+ 'finish_wt': [finish_wt],
181
+ 'grade_type': [grade_type],
182
+ 'material_id': [material_id],
183
+ 'input_weight': [predicted_input_weight],
184
+ 'raw_material_cost': [raw_material_cost],
185
+ 'process_cost': [process_cost],
186
+ 'machining_time': [predicted_machining_time],
187
+ 'machining_cost': [machining_cost],
188
+ 'scrap_recovery': [scrap_recovery],
189
+ 'inspection_time': [predicted_inspection_time],
190
+ 'inspection_cost': [inspection_cost],
191
+ 'total_mg_cost': [total_mg_cost]
192
  })
193
  insert_data(conn, 'supplier_data', supplier_data)
194
  st.success("Supplier data added successfully")