Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ from sklearn.neighbors import KNeighborsClassifier
|
|
| 9 |
from sklearn.tree import DecisionTreeClassifier
|
| 10 |
from sklearn.naive_bayes import GaussianNB
|
| 11 |
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
|
| 12 |
-
from tabulate import tabulate
|
| 13 |
|
| 14 |
# File uploader
|
| 15 |
st.title("Model Training with Metrics")
|
|
@@ -81,20 +80,9 @@ if uploaded_file is not None:
|
|
| 81 |
# Create a metrics DataFrame
|
| 82 |
metrics_df = pd.DataFrame(metrics)
|
| 83 |
|
| 84 |
-
#
|
| 85 |
-
table = tabulate(
|
| 86 |
-
metrics_df,
|
| 87 |
-
headers=['\033[1m' + header + '\033[0m' for header in metrics_df.columns], # Bold headers
|
| 88 |
-
tablefmt="grid", # Set table format to grid for borders
|
| 89 |
-
showindex=False,
|
| 90 |
-
numalign="center",
|
| 91 |
-
stralign="center"
|
| 92 |
-
)
|
| 93 |
-
|
| 94 |
-
# Display results in Streamlit
|
| 95 |
st.subheader("Model Performance Metrics")
|
| 96 |
-
st.
|
| 97 |
-
st.text(table)
|
| 98 |
|
| 99 |
# Option to download the model performance metrics (Results Table)
|
| 100 |
st.download_button(
|
|
@@ -104,10 +92,4 @@ if uploaded_file is not None:
|
|
| 104 |
mime="text/csv"
|
| 105 |
)
|
| 106 |
|
| 107 |
-
|
| 108 |
-
st.download_button(
|
| 109 |
-
label="Download Dataset",
|
| 110 |
-
data=df.to_csv(index=False),
|
| 111 |
-
file_name="dataset.csv",
|
| 112 |
-
mime="text/csv"
|
| 113 |
-
)
|
|
|
|
| 9 |
from sklearn.tree import DecisionTreeClassifier
|
| 10 |
from sklearn.naive_bayes import GaussianNB
|
| 11 |
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
|
|
|
|
| 12 |
|
| 13 |
# File uploader
|
| 14 |
st.title("Model Training with Metrics")
|
|
|
|
| 80 |
# Create a metrics DataFrame
|
| 81 |
metrics_df = pd.DataFrame(metrics)
|
| 82 |
|
| 83 |
+
# Display results in a table using st.dataframe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
st.subheader("Model Performance Metrics")
|
| 85 |
+
st.dataframe(metrics_df)
|
|
|
|
| 86 |
|
| 87 |
# Option to download the model performance metrics (Results Table)
|
| 88 |
st.download_button(
|
|
|
|
| 92 |
mime="text/csv"
|
| 93 |
)
|
| 94 |
|
| 95 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|