BilalSardar commited on
Commit
6dab2c6
·
1 Parent(s): 7cdbf5c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -0
app.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from operator import index
2
+ import streamlit as st
3
+ import plotly.express as px
4
+ from pycaret.regression import setup, compare_models, pull, save_model, load_model
5
+ import pandas_profiling
6
+ import pandas as pd
7
+ from streamlit_pandas_profiling import st_profile_report
8
+ import os
9
+
10
+ if os.path.exists('./dataset.csv'):
11
+ df = pd.read_csv('dataset.csv', index_col=None)
12
+
13
+ with st.sidebar:
14
+ st.image("https://www.onepointltd.com/wp-content/uploads/2020/03/inno2.png")
15
+ st.title("AutoNickML")
16
+ choice = st.radio("Navigation", ["Upload","Profiling","Modelling", "Download"])
17
+ st.info("This project application helps you build and explore your data.")
18
+
19
+ if choice == "Upload":
20
+ st.title("Upload Your Dataset")
21
+ file = st.file_uploader("Upload Your Dataset")
22
+ if file:
23
+ df = pd.read_csv(file, index_col=None)
24
+ df.to_csv('dataset.csv', index=None)
25
+ st.dataframe(df)
26
+
27
+ if choice == "Profiling":
28
+ st.title("Exploratory Data Analysis")
29
+ profile_df = df.profile_report()
30
+ st_profile_report(profile_df)
31
+
32
+ if choice == "Modelling":
33
+ chosen_target = st.selectbox('Choose the Target Column', df.columns)
34
+ if st.button('Run Modelling'):
35
+ setup(df, target=chosen_target, silent=True)
36
+ setup_df = pull()
37
+ st.dataframe(setup_df)
38
+ best_model = compare_models()
39
+ compare_df = pull()
40
+ st.dataframe(compare_df)
41
+ save_model(best_model, 'best_model')
42
+
43
+ if choice == "Download":
44
+ with open('best_model.pkl', 'rb') as f:
45
+ st.download_button('Download Model', f, file_name="best_model.pkl")