thov commited on
Commit
80eea30
1 Parent(s): ddfdc54

stable version

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -5,8 +5,6 @@ st.set_page_config(layout="wide")
5
 
6
  st.title("Graph Correlation")
7
 
8
- col1, col2, col3 = st.columns((1,1,1))
9
-
10
  if 'default' not in st.session_state:
11
  st.session_state.default = True
12
 
@@ -15,17 +13,16 @@ def default():
15
 
16
  with st.sidebar:
17
 
18
- upload_csv = st.file_uploader(label='CSV file to analyse')
19
-
20
- default_csv = st.selectbox(label=' Or Choose a Default Dataset', options=['spotify.csv', 'heart.csv', 'titanic.csv', 'pokemon.csv'])
21
- default_csv = 'datasets/'+default_csv
22
 
23
- if upload_csv != False:
24
- default_csv = False
 
25
 
26
- corr_type = st.selectbox(label='Correlation Type', options=['kendall', 'pearson', 'spearman'])
27
 
28
- th = st.slider(label='Correlation Threshold', min_value=0., max_value=1., value=0.15, step=0.01)
29
 
30
  but = st.button("Display Correlation Graph", on_click=default)
31
 
@@ -33,10 +30,6 @@ if st.session_state.default:
33
  graph_html = display_graph(csv_file='datasets/spotify.csv', threshold=0.15, corr_type='kendall')
34
  st.components.v1.html(graph_html, width=None, height=2000)
35
 
36
- if (but == True) and (default_csv != False):
37
- graph_html = display_graph(csv_file=default_csv, threshold=th, corr_type=corr_type)
38
- st.components.v1.html(graph_html, width=None, height=2000)
39
-
40
- if (but == True) and (upload_csv != False):
41
- graph_html = display_graph(csv_file=upload_csv, threshold=th, corr_type=corr_type)
42
  st.components.v1.html(graph_html, width=None, height=2000)
 
5
 
6
  st.title("Graph Correlation")
7
 
 
 
8
  if 'default' not in st.session_state:
9
  st.session_state.default = True
10
 
 
13
 
14
  with st.sidebar:
15
 
16
+ def_csv = st.selectbox(label='Demo Datasets', options=['spotify.csv', 'heart.csv', 'titanic.csv', 'pokemon.csv'])
17
+ def_csv = 'datasets/'+def_csv
 
 
18
 
19
+ csv = st.file_uploader(label='or upload a CSV file to analyse')
20
+ if csv == None:
21
+ csv=def_csv
22
 
23
+ corr_type = st.selectbox(label='Correlation Type', options=['kendall', 'pearson', 'spearman'], on_change=default)
24
 
25
+ th = st.slider(label='Correlation Threshold', min_value=0., max_value=1., value=0.15, step=0.01, on_change=default)
26
 
27
  but = st.button("Display Correlation Graph", on_click=default)
28
 
 
30
  graph_html = display_graph(csv_file='datasets/spotify.csv', threshold=0.15, corr_type='kendall')
31
  st.components.v1.html(graph_html, width=None, height=2000)
32
 
33
+ if but:
34
+ graph_html = display_graph(csv_file=csv, threshold=th, corr_type=corr_type)
 
 
 
 
35
  st.components.v1.html(graph_html, width=None, height=2000)