File size: 1,417 Bytes
d1cc84a
 
 
 
 
471f224
 
33f164a
d4dc4f4
d1cc84a
 
eb3d6bf
 
d1cc84a
eb3d6bf
d1cc84a
 
eb3d6bf
 
 
d1cc84a
eb3d6bf
d1cc84a
 
 
 
 
 
 
 
 
 
 
471f224
 
 
d1cc84a
 
471f224
 
 
 
d1cc84a
 
 
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
import streamlit as st
import pandas as pd
import plotly.express as px
from datasets import load_dataset
import os
from src.basic_plot import basic_chart
from src.map_viz import calling_map_viz
from src.data_ingestion import daily_average


def main():

    # comment out for local testing, but be sure to include after testing
    dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
    # print (dataset)
    # print (pd.DataFrame(dataset['train']))
    counts_df = pd.DataFrame(dataset['train'])

    # only use this part before for local testing
    # once local testing is completed, comment out and use the dataset above
    # counts_df = pd.read_csv("data/counts_dataset.csv")

    # st.set_page_config(layout="wide")
    height = 650

    st.markdown(""" <style>
                #MainMenu {visibility: hidden;}
                footer {visibility: hidden;}
                </style> """, 
                unsafe_allow_html=True
                )

    # Select Plot Option
    st.sidebar.markdown("Select Plots to show")
    checkbox_one = st.sidebar.checkbox('Overall Traffic', value = True) # rename as necessary
    checkbox_two = st.sidebar.checkbox('Traffic Map', value = True)

    if checkbox_one:
        st.plotly_chart(basic_chart(counts_df),use_container_width=True)

    if checkbox_two:
        st.pyplot(calling_map_viz(counts_df))

if __name__ == "__main__":
    main()