Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -984,17 +984,19 @@ elif app_mode == "Model Training":
|
|
| 984 |
except Exception as e:
|
| 985 |
st.error(f"An error occurred during training: {e}")
|
| 986 |
|
| 987 |
-
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
|
|
|
|
|
|
| 998 |
|
| 999 |
# Visualization Lab Section
|
| 1000 |
elif app_mode == "Visualization Lab":
|
|
|
|
| 984 |
except Exception as e:
|
| 985 |
st.error(f"An error occurred during training: {e}")
|
| 986 |
|
| 987 |
+
if st.session_state.model is not None:
|
| 988 |
+
st.subheader("💾 Save Model")
|
| 989 |
+
model_filename = st.text_input("Enter Model Filename (without extension)", "trained_model")
|
| 990 |
+
|
| 991 |
+
if st.button("Save Model"):
|
| 992 |
+
try:
|
| 993 |
+
joblib.dump(st.session_state.model, f"{model_filename}.joblib")
|
| 994 |
+
st.success(f"Model saved as {model_filename}.joblib")
|
| 995 |
+
except Exception as e:
|
| 996 |
+
st.error(f"Error saving model: {e}")
|
| 997 |
+
else:
|
| 998 |
+
st.warning("No trained model available. Train a model first to enable saving.")
|
| 999 |
+
|
| 1000 |
|
| 1001 |
# Visualization Lab Section
|
| 1002 |
elif app_mode == "Visualization Lab":
|