Spaces:
Build error
Build error
Amdjedbens
commited on
Commit
·
0d346b7
1
Parent(s):
0055516
Updated application file
Browse files- app.py +53 -2
- requirements.txt +4 -0
app.py
CHANGED
@@ -1,5 +1,56 @@
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
import pandas as pd
|
4 |
+
import pandas_profiling
|
5 |
import streamlit as st
|
6 |
+
#ML stuff
|
7 |
+
from pycaret.classification import compare_models, pull, save_model, setup
|
8 |
+
from pycaret.regression import compare_models, pull, save_model, setup
|
9 |
+
from streamlit_pandas_profiling import st_profile_report
|
10 |
+
|
11 |
+
with st.sidebar:
|
12 |
+
st.image("https://cdn.pixabay.com/photo/2018/09/18/11/19/artificial-intelligence-3685928_1280.png")
|
13 |
+
st.title("EasyAutoML")
|
14 |
+
choice = st.radio("Navigation",["Data loading","Exploratory","Modeling","Download"])
|
15 |
+
st.info("This application to explore your data & build an automated ML pipeline.")
|
16 |
+
|
17 |
+
|
18 |
+
if os.path.exists("source_data.csv"):
|
19 |
+
df = pd.read_csv("source_data.csv", index_col=None)
|
20 |
+
|
21 |
+
|
22 |
+
if choice == "Data loading":
|
23 |
+
st.title("Upload your data for modeling")
|
24 |
+
file = st.file_uploader("Upload your dataset here")
|
25 |
+
if file:
|
26 |
+
df = pd.read_csv(file, index_col=None)
|
27 |
+
df.to_csv("source_data.csv", index=None)
|
28 |
+
st.dataframe(df)
|
29 |
|
30 |
+
elif choice == "Exploratory":
|
31 |
+
st.title('Automated EDA')
|
32 |
+
profile_report = df.profile_report()
|
33 |
+
st_profile_report(profile_report)
|
34 |
+
|
35 |
+
elif choice == "Modeling":
|
36 |
+
|
37 |
+
st.title('Time for ML')
|
38 |
+
target = st.selectbox('Choose the target column', df.columns)
|
39 |
+
if st.button("Train model"):
|
40 |
+
setup(df, target=target, silent=True)
|
41 |
+
setup_df = pull()
|
42 |
+
st.info("This is the ML experiment settings")
|
43 |
+
st.dataframe(setup_df)
|
44 |
+
best_model = compare_models()
|
45 |
+
compare_df = pull()
|
46 |
+
st.info("This is the ML model")
|
47 |
+
st.dataframe(compare_df)
|
48 |
+
best_model
|
49 |
+
save_model(best_model, 'best_model')
|
50 |
+
elif choice == "Download":
|
51 |
+
with open("best_model.pkl",'rb') as f:
|
52 |
+
st.download_button("Download the model file",f,"best_model.pkl")
|
53 |
+
else:
|
54 |
+
pass
|
55 |
|
56 |
+
st.write("Made with <3 by Amdjed")
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pycaret==2.3.10
|
2 |
+
streamlit-pandas-profiling
|
3 |
+
pandas-profiling
|
4 |
+
streamlit
|