Spaces:
Sleeping
Sleeping
tappyness1
commited on
Commit
•
d1cc84a
1
Parent(s):
9adb5c2
initial app
Browse files- app.py +44 -0
- data/.gitkeep +0 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import plotly.express as px
|
4 |
+
from datasets import load_dataset
|
5 |
+
import os
|
6 |
+
|
7 |
+
@st.cache()
|
8 |
+
def bar_chart(counts_df):
|
9 |
+
fig = px.bar(counts_df, x = 'car', y = 'large_vehicle')
|
10 |
+
|
11 |
+
# fig_app_by_arc.update_layout(
|
12 |
+
# xaxis_title="Name",
|
13 |
+
# yaxis_title="",
|
14 |
+
# )
|
15 |
+
return fig
|
16 |
+
|
17 |
+
|
18 |
+
def main():
|
19 |
+
dataset = load_dataset("tappyness1/causion", use_auth_token=os.environ['TOKEN'])
|
20 |
+
print (dataset)
|
21 |
+
# print (pd.DataFrame(dataset['train']))
|
22 |
+
counts_df = pd.DataFrame(dataset['train'])
|
23 |
+
# counts_df = pd.read_csv("data/counts_dataset.csv")
|
24 |
+
# st.set_page_config(layout="wide")
|
25 |
+
height = 650
|
26 |
+
|
27 |
+
st.markdown(""" <style>
|
28 |
+
#MainMenu {visibility: hidden;}
|
29 |
+
footer {visibility: hidden;}
|
30 |
+
</style> """,
|
31 |
+
unsafe_allow_html=True
|
32 |
+
)
|
33 |
+
|
34 |
+
# Select Plot Option
|
35 |
+
st.sidebar.markdown("Checkboxes")
|
36 |
+
checkbox_one = st.sidebar.checkbox('Lorem Ip', value = True) # rename as necessary
|
37 |
+
checkbox_two = st.sidebar.checkbox('Lorem Ipsum', value = False)
|
38 |
+
|
39 |
+
if checkbox_one:
|
40 |
+
st.write("Simple Bar Chart")
|
41 |
+
st.plotly_chart(bar_chart(counts_df),use_container_width=True)
|
42 |
+
|
43 |
+
if __name__ == "__main__":
|
44 |
+
main()
|
data/.gitkeep
ADDED
File without changes
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
plotly
|
3 |
+
datasets
|