Rui Wan
commited on
Commit
·
7bb8939
1
Parent(s):
1905df2
update
Browse files- __pycache__/model_fdm.cpython-312.pyc +0 -0
- app.py +8 -10
- model_fdm.py +4 -1
__pycache__/model_fdm.cpython-312.pyc
ADDED
|
Binary file (21.6 kB). View file
|
|
|
app.py
CHANGED
|
@@ -259,7 +259,7 @@ if st.session_state.AM_input_changed == True:
|
|
| 259 |
st.session_state.AM_design_button_clicked = False
|
| 260 |
st.session_state.AM_input_changed = False
|
| 261 |
|
| 262 |
-
st.button("AM process design",
|
| 263 |
|
| 264 |
if st.session_state.AM_design_button_clicked == True:
|
| 265 |
st.write("Process parameters")
|
|
@@ -282,21 +282,19 @@ if st.session_state.AM_design_button_clicked == True:
|
|
| 282 |
st.dataframe(data1, hide_index=True, width=500)
|
| 283 |
|
| 284 |
data2 = pd.DataFrame({
|
| 285 |
-
'Nozzel velocity (cm/s)': best['input'][0],
|
| 286 |
-
'Extruder temperature (C)': best['input'][1],
|
| 287 |
-
'Bed temperature (C)': best['input'][2]})
|
| 288 |
st.dataframe(data2, hide_index=True, width=500)
|
| 289 |
|
| 290 |
data3 = pd.DataFrame({
|
| 291 |
-
'Maximum angle A (degree)': best['output'][0],
|
| 292 |
-
'Maximum angle B (degree)': best['output'][1],
|
| 293 |
-
'Maximum angle C (degree)': best['output'][2],
|
| 294 |
-
'Maximum residual stress': best['output'][3]
|
| 295 |
})
|
| 296 |
st.dataframe(data3, hide_index=True, width=700)
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
-
|
| 302 |
-
|
|
|
|
| 259 |
st.session_state.AM_design_button_clicked = False
|
| 260 |
st.session_state.AM_input_changed = False
|
| 261 |
|
| 262 |
+
st.button("AM process design", use_container_width=True, on_click=AM_design_click)
|
| 263 |
|
| 264 |
if st.session_state.AM_design_button_clicked == True:
|
| 265 |
st.write("Process parameters")
|
|
|
|
| 282 |
st.dataframe(data1, hide_index=True, width=500)
|
| 283 |
|
| 284 |
data2 = pd.DataFrame({
|
| 285 |
+
'Nozzel velocity (cm/s)': [best['input'][0]],
|
| 286 |
+
'Extruder temperature (C)': [best['input'][1]],
|
| 287 |
+
'Bed temperature (C)': [best['input'][2]]})
|
| 288 |
st.dataframe(data2, hide_index=True, width=500)
|
| 289 |
|
| 290 |
data3 = pd.DataFrame({
|
| 291 |
+
'Maximum angle A (degree)': [best['output'][0]],
|
| 292 |
+
'Maximum angle B (degree)': [best['output'][1]],
|
| 293 |
+
'Maximum angle C (degree)': [best['output'][2]],
|
| 294 |
+
'Maximum residual stress': [best['output'][3]]
|
| 295 |
})
|
| 296 |
st.dataframe(data3, hide_index=True, width=700)
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
|
|
|
|
|
model_fdm.py
CHANGED
|
@@ -5,7 +5,10 @@ from Dataset import DataAdditiveManufacturing, DataThermoforming
|
|
| 5 |
from model import NeuralNetwork
|
| 6 |
|
| 7 |
DEVICE = torch.device('cpu')
|
|
|
|
| 8 |
|
|
|
|
|
|
|
| 9 |
# Set global plotting parameters
|
| 10 |
plt.rcParams.update({'font.size': 14,
|
| 11 |
'figure.figsize': (10, 8),
|
|
@@ -249,7 +252,7 @@ def main():
|
|
| 249 |
torch.save(checkpoint, model_save_path)
|
| 250 |
|
| 251 |
def load_model(model_path):
|
| 252 |
-
checkpoint = torch.load(model_path)
|
| 253 |
model_config = checkpoint['model_config']
|
| 254 |
model = NeuralNetwork(model_config['layer_sizes'], dropout_rate=model_config['dropout_rate'], activation=torch.nn.ReLU).to(DEVICE)
|
| 255 |
model.load_state_dict(checkpoint['model_state_dict'])
|
|
|
|
| 5 |
from model import NeuralNetwork
|
| 6 |
|
| 7 |
DEVICE = torch.device('cpu')
|
| 8 |
+
<<<<<<< HEAD
|
| 9 |
|
| 10 |
+
=======
|
| 11 |
+
>>>>>>> 1951294 (update)
|
| 12 |
# Set global plotting parameters
|
| 13 |
plt.rcParams.update({'font.size': 14,
|
| 14 |
'figure.figsize': (10, 8),
|
|
|
|
| 252 |
torch.save(checkpoint, model_save_path)
|
| 253 |
|
| 254 |
def load_model(model_path):
|
| 255 |
+
checkpoint = torch.load(model_path, map_location=DEVICE)
|
| 256 |
model_config = checkpoint['model_config']
|
| 257 |
model = NeuralNetwork(model_config['layer_sizes'], dropout_rate=model_config['dropout_rate'], activation=torch.nn.ReLU).to(DEVICE)
|
| 258 |
model.load_state_dict(checkpoint['model_state_dict'])
|