Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -984,18 +984,17 @@ 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 |
-
st.warning("No trained model available. Train a model first to enable saving.")
|
999 |
|
1000 |
|
1001 |
# Visualization Lab Section
|
|
|
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 |
+
if st.button("Save Model"):
|
991 |
+
try:
|
992 |
+
joblib.dump(st.session_state.model, f"{model_filename}.joblib")
|
993 |
+
st.success(f"Model saved as {model_filename}.joblib")
|
994 |
+
except Exception as e:
|
995 |
+
st.error(f"Error saving model: {e}")
|
996 |
+
else:
|
997 |
+
st.warning("No trained model available. Train a model first to enable saving.")
|
|
|
998 |
|
999 |
|
1000 |
# Visualization Lab Section
|