-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
120 lines (103 loc) · 3.41 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import streamlit as st
from pages import (
home,
data_info,
reg_preprocessing,
prediction,
reg_training,
reg_model_analysis,
cls_preprocessing,
cls_training,
cls_model_analysis,
cluster_preprocessing,
cluster_training,
cluster_model_analysis,
)
# from utils.session import _get_state
from pathlib import Path
from utils.image_loader import *
PAGES = {
"Home": home,
"DataInfo": data_info,
"Preprocessing": (reg_preprocessing, cls_preprocessing, cluster_preprocessing),
"Training": (reg_training, cls_training, cluster_training),
"Model Performance Analysis": (
reg_model_analysis,
cls_model_analysis,
cluster_model_analysis,
),
# "Prediction and Save": prediction,
}
IMAGE_FOLDER = Path("images/")
def run():
# state = _get_state()
state = st.session_state
st.set_page_config(
page_title="Give Everybody MachineLearning",
layout="centered",
page_icon= str(IMAGE_FOLDER / "gem_logo.png"),
initial_sidebar_state="expanded",
)
load_nav_image(IMAGE_FOLDER / "gem_logo.png")
st.title("Give Everybody MachineLearning")
st.markdown(
"Please check github repo here :point_right: [gem github repo](https://github.com/WangCHEN9/gem)"
)
st.markdown("""---""")
st.sidebar.title("Navigation")
selection = st.sidebar.radio("To be done step by step", list(PAGES.keys()))
if selection == "Home":
try:
state_df, task = PAGES[selection].write(state)
state.df, state.task = state_df, task
state.log_history = {}
state.is_remove = False
state.ignore_columns = []
except:
st.header("Please Upload Csv or Excel File first!")
st.stop()
if selection == "DataInfo":
try:
PAGES[selection].write(state.df)
except AttributeError:
st.error("Please Upload Csv or Excel File first!")
if selection == "Preprocessing":
try:
if state.task == "Regression":
PAGES[selection][0].write(state)
elif state.task == "Classification":
PAGES[selection][1].write(state)
else:
PAGES[selection][2].write(state)
except AttributeError:
st.error("Please Upload Csv or Excel File first!")
if selection == "Training":
try:
if state.task == "Regression":
PAGES[selection][0].write(state)
elif state.task == "Classification":
PAGES[selection][1].write(state)
else:
PAGES[selection][2].write(state)
except AttributeError as err:
st.error(f'please run Preprocess step first !')
st.warning(err)
if selection == "Model Performance Analysis":
try:
if state.task == "Regression":
PAGES[selection][0].write(state)
elif state.task == "Classification":
PAGES[selection][1].write(state)
else:
PAGES[selection][2].write(state)
except AttributeError as err:
st.error(f'please run Training step first !')
st.warning(err)
if selection == "Prediction and Save":
try:
PAGES[selection].write(state)
except AttributeError as err:
st.warning(err)
# state.sync()
if __name__ == "__main__":
run()