Spaces:
Sleeping
Sleeping
File size: 1,182 Bytes
21d7cfa 341f5b8 21d7cfa ddfdc54 b0ca261 ddfdc54 80eea30 ddfdc54 80eea30 341f5b8 80eea30 ddfdc54 80eea30 341f5b8 ddfdc54 21d7cfa ddfdc54 ea74670 80eea30 ddfdc54 |
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 |
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) |