-
Notifications
You must be signed in to change notification settings - Fork 2
/
streamlit-app.py
64 lines (50 loc) · 1.66 KB
/
streamlit-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
import numpy as np
import pandas as pd
import streamlit as st
import plotly.figure_factory as ff
data = pd.read_csv("twitter.csv", sep=",")
with st.sidebar:
st.write("Do you like this app?")
cbox = st.checkbox('yes')
def tabs(default_tabs = [], default_active_tab=0):
if not default_tabs:
return None
active_tab = st.radio("", default_tabs, index=default_active_tab, key='tabs')
child = default_tabs.index(active_tab)+1
st.markdown("""
<style type="text/css">
div[role=radiogroup] > label > div:first-of-type, .stRadio > label {
display: none;
}
div[role=radiogroup] {
flex-direction: unset
}
div[role=radiogroup] label {
border: 1px solid #999;
background: #EEE;
padding: 4px 12px;
border-radius: 4px 4px 0 0;
position: relative;
top: 1px;
}
div[role=radiogroup] label:nth-child(""" + str(child) + """) {
background: #FFF !important;
border-bottom: 1px solid transparent;
}
</style>
""", unsafe_allow_html=True)
return active_tab
active_tab = tabs(["Light Side", "Dark Side"])
if st.sidebar.button('Get Results'):
if cbox:
if (active_tab == "Light Side"):
st.write(data)
st.dataframe(data["Tweet Impressions"])
st.table(data)
else:
layout = st.columns([1, 2])
with layout[0]:
st.write("Column A")
with layout[-1]:
st.write("Column B")
st.line_chart(data['Tweets'])