thov's picture
stable version
80eea30
raw
history blame
No virus
1.18 kB
import streamlit as st
from utils import display_graph
st.set_page_config(layout="wide")
st.title("Graph Correlation")
if 'default' not in st.session_state:
st.session_state.default = True
def default():
st.session_state.default = False
with st.sidebar:
def_csv = st.selectbox(label='Demo Datasets', options=['spotify.csv', 'heart.csv', 'titanic.csv', 'pokemon.csv'])
def_csv = 'datasets/'+def_csv
csv = st.file_uploader(label='or upload a CSV file to analyse')
if csv == None:
csv=def_csv
corr_type = st.selectbox(label='Correlation Type', options=['kendall', 'pearson', 'spearman'], on_change=default)
th = st.slider(label='Correlation Threshold', min_value=0., max_value=1., value=0.15, step=0.01, on_change=default)
but = st.button("Display Correlation Graph", on_click=default)
if st.session_state.default:
graph_html = display_graph(csv_file='datasets/spotify.csv', threshold=0.15, corr_type='kendall')
st.components.v1.html(graph_html, width=None, height=2000)
if but:
graph_html = display_graph(csv_file=csv, threshold=th, corr_type=corr_type)
st.components.v1.html(graph_html, width=None, height=2000)