Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import pandas as pd
|
|
| 3 |
from pycaret.classification import *
|
| 4 |
from pycaret.regression import *
|
| 5 |
from pycaret.clustering import *
|
| 6 |
-
from sklearn.model_selection import train_test_split
|
| 7 |
import os
|
| 8 |
|
| 9 |
# Set page config
|
|
@@ -47,23 +46,23 @@ elif app_mode == "Model Training":
|
|
| 47 |
problem_type = st.selectbox("Problem Type", ["Classification", "Regression", "Clustering"])
|
| 48 |
target = st.selectbox("Select Target Column", df.columns) if problem_type != "Clustering" else None
|
| 49 |
|
| 50 |
-
if problem_type == "Clustering":
|
| 51 |
-
st.info("Clustering does not require a target column. PyCaret will automatically group the data.")
|
| 52 |
-
|
| 53 |
if st.button("Setup PyCaret"):
|
| 54 |
with st.spinner("Setting up PyCaret..."):
|
| 55 |
if problem_type == "Classification":
|
| 56 |
-
setup(data=df, session_id=123, verbose=False)
|
| 57 |
st.session_state.problem_type = "Classification"
|
|
|
|
| 58 |
elif problem_type == "Regression":
|
| 59 |
-
setup(data=df, session_id=123, verbose=False)
|
| 60 |
st.session_state.problem_type = "Regression"
|
|
|
|
| 61 |
elif problem_type == "Clustering":
|
| 62 |
setup(data=df, session_id=123, verbose=False)
|
| 63 |
st.session_state.problem_type = "Clustering"
|
|
|
|
| 64 |
st.success("PyCaret setup complete! You can now train models.")
|
| 65 |
|
| 66 |
-
if
|
| 67 |
st.subheader("Train Models")
|
| 68 |
if st.button("Compare Models"):
|
| 69 |
with st.spinner("Comparing models..."):
|
|
|
|
| 3 |
from pycaret.classification import *
|
| 4 |
from pycaret.regression import *
|
| 5 |
from pycaret.clustering import *
|
|
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Set page config
|
|
|
|
| 46 |
problem_type = st.selectbox("Problem Type", ["Classification", "Regression", "Clustering"])
|
| 47 |
target = st.selectbox("Select Target Column", df.columns) if problem_type != "Clustering" else None
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
if st.button("Setup PyCaret"):
|
| 50 |
with st.spinner("Setting up PyCaret..."):
|
| 51 |
if problem_type == "Classification":
|
| 52 |
+
setup(data=df, target=target, session_id=123, verbose=False)
|
| 53 |
st.session_state.problem_type = "Classification"
|
| 54 |
+
st.session_state.setup_complete = True
|
| 55 |
elif problem_type == "Regression":
|
| 56 |
+
setup(data=df, target=target, session_id=123, verbose=False)
|
| 57 |
st.session_state.problem_type = "Regression"
|
| 58 |
+
st.session_state.setup_complete = True
|
| 59 |
elif problem_type == "Clustering":
|
| 60 |
setup(data=df, session_id=123, verbose=False)
|
| 61 |
st.session_state.problem_type = "Clustering"
|
| 62 |
+
st.session_state.setup_complete = True
|
| 63 |
st.success("PyCaret setup complete! You can now train models.")
|
| 64 |
|
| 65 |
+
if st.session_state.get("setup_complete", False):
|
| 66 |
st.subheader("Train Models")
|
| 67 |
if st.button("Compare Models"):
|
| 68 |
with st.spinner("Comparing models..."):
|