Skip to content

Commit 2fa667d

Browse files
authored
Add files via upload
0 parents  commit 2fa667d

13 files changed

+324
-0
lines changed

β€Ž1_πŸ“ˆ_Main.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import pickle
2+
from pathlib import Path
3+
4+
import pandas as pd # pip install pandas openpyxl
5+
import plotly.express as px # pip install plotly-express
6+
import streamlit as st # pip install streamlit
7+
import streamlit_authenticator as stauth # pip install streamlit-authenticator
8+
9+
10+
# emojis: https://www.webfx.com/tools/emoji-cheat-sheet/
11+
st.set_page_config(page_title="streamlit Dashboard", page_icon=":bar_chart:", layout="wide")
12+
13+
hide_bar= """
14+
<style>
15+
[data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
16+
visibility:hidden;
17+
width: 0px;
18+
}
19+
[data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
20+
visibility:hidden;
21+
}
22+
</style>
23+
"""
24+
25+
# --- USER AUTHENTICATION ---
26+
names = ["Peter Parker", "Rebecca Miller","bharath"]
27+
usernames = ["pparker", "rmiller","bharath"]
28+
29+
# load hashed passwords
30+
file_path = Path(__file__).parent / "hashed_pw.pkl"
31+
with file_path.open("rb") as file:
32+
hashed_passwords = pickle.load(file)
33+
34+
authenticator = stauth.Authenticate(names, usernames, hashed_passwords,
35+
"SIPL_dashboard", "abcdef")
36+
37+
name, authentication_status, username = authenticator.login("Login", "main")
38+
39+
if authentication_status == False:
40+
st.error("Username/password is incorrect")
41+
st.markdown(hide_bar, unsafe_allow_html=True)
42+
43+
if authentication_status == None:
44+
st.warning("Please enter your username and password")
45+
st.markdown(hide_bar, unsafe_allow_html=True)
46+
47+
48+
if authentication_status:
49+
# # ---- SIDEBAR ----
50+
st.sidebar.title(f"Welcome {name}")
51+
# st.sidebar.header("select page here :")
52+
st.write("# Welcome to Streamlit!..")
53+
54+
###about ....
55+
st.subheader("Introduction :")
56+
st.text("1. \n2. \n3. \n4. \n5. \n")
57+
58+
st.sidebar.success("Select a page above.")
59+
60+
###---- HIDE STREAMLIT STYLE ----
61+
hide_st_style = """
62+
<style>
63+
#MainMenu {visibility: hidden;}
64+
footer {visibility: hidden;}
65+
header {visibility: hidden;}
66+
</style>
67+
"""
68+
st.markdown(hide_st_style, unsafe_allow_html=True)
69+
70+
71+
authenticator.logout("Logout", "sidebar")

β€ŽREADME.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# streamlit-multipage-authentication

β€Žgenerate_keys.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
### Generate keys
2+
3+
4+
import pickle
5+
from pathlib import Path
6+
7+
import streamlit_authenticator as stauth
8+
9+
names = ["Peter Parker", "Rebecca Miller","bharath"]
10+
usernames = ["pparker", "rmiller","bharath"]
11+
passwords = ["XXX", "XXX","1234"]
12+
13+
hashed_passwords = stauth.Hasher(passwords).generate()
14+
15+
file_path = Path(__file__).parent / "hashed_pw.pkl"
16+
with file_path.open("wb") as file:
17+
pickle.dump(hashed_passwords, file)

β€Žhashed_pw.pkl

205 Bytes
Binary file not shown.

β€Žpages/1_πŸ’½_yolo.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("YOLO")
17+
"# πŸ“ˆ YOLO v3~vX"

β€Žpages/2_πŸ“Š_analysis.py

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import pickle
2+
from pathlib import Path
3+
4+
import pandas as pd # pip install pandas openpyxl
5+
import plotly.express as px # pip install plotly-express
6+
import streamlit as st # pip install streamlit
7+
8+
9+
10+
# emojis: https://www.webfx.com/tools/emoji-cheat-sheet/
11+
st.set_page_config(page_title="Sales Dashboard", page_icon=":bar_chart:", layout="wide")
12+
13+
14+
15+
def get_data_from_excel():
16+
df = pd.read_excel(
17+
io="pages/supermarkt_sales.xlsx",
18+
engine="openpyxl",
19+
sheet_name="Sales",
20+
skiprows=3,
21+
usecols="B:R",
22+
nrows=1000,
23+
)
24+
# Add 'hour' column to dataframe
25+
df["hour"] = pd.to_datetime(df["Time"], format="%H:%M:%S").dt.hour
26+
return df
27+
28+
df = get_data_from_excel()
29+
30+
# ---- SIDEBAR ----
31+
# authenticator.logout("Logout", "sidebar")
32+
name='bharath'
33+
st.sidebar.title(f"Welcome {name}")
34+
st.sidebar.header("Please Filter Here:")
35+
city = st.sidebar.multiselect(
36+
"Select the City:",
37+
options=df["City"].unique(),
38+
default=df["City"].unique()
39+
)
40+
41+
customer_type = st.sidebar.multiselect(
42+
"Select the Customer Type:",
43+
options=df["Customer_type"].unique(),
44+
default=df["Customer_type"].unique(),
45+
)
46+
47+
gender = st.sidebar.multiselect(
48+
"Select the Gender:",
49+
options=df["Gender"].unique(),
50+
default=df["Gender"].unique()
51+
)
52+
53+
df_selection = df.query(
54+
"City == @city & Customer_type ==@customer_type & Gender == @gender"
55+
)
56+
57+
# ---- MAINPAGE ----
58+
st.title(":bar_chart: Sales Dashboard")
59+
st.markdown("##")
60+
61+
# TOP KPI's
62+
total_sales = int(df_selection["Total"].sum())
63+
average_rating = round(df_selection["Rating"].mean(), 1)
64+
star_rating = ":star:" * int(round(average_rating, 0))
65+
average_sale_by_transaction = round(df_selection["Total"].mean(), 2)
66+
67+
left_column, middle_column, right_column = st.columns(3)
68+
with left_column:
69+
st.subheader("Total Sales:")
70+
st.subheader(f"US $ {total_sales:,}")
71+
with middle_column:
72+
st.subheader("Average Rating:")
73+
st.subheader(f"{average_rating} {star_rating}")
74+
with right_column:
75+
st.subheader("Average Sales Per Transaction:")
76+
st.subheader(f"US $ {average_sale_by_transaction}")
77+
78+
st.markdown("""---""")
79+
80+
# SALES BY PRODUCT LINE [BAR CHART]
81+
sales_by_product_line = (
82+
df_selection.groupby(by=["Product line"]).sum()[["Total"]].sort_values(by="Total")
83+
)
84+
fig_product_sales = px.bar(
85+
sales_by_product_line,
86+
x="Total",
87+
y=sales_by_product_line.index,
88+
orientation="h",
89+
title="<b>Sales by Product Line</b>",
90+
color_discrete_sequence=["#0083B8"] * len(sales_by_product_line),
91+
template="plotly_white",
92+
)
93+
fig_product_sales.update_layout(
94+
plot_bgcolor="rgba(0,0,0,0)",
95+
xaxis=(dict(showgrid=False))
96+
)
97+
98+
# SALES BY HOUR [BAR CHART]
99+
sales_by_hour = df_selection.groupby(by=["hour"]).sum()[["Total"]]
100+
fig_hourly_sales = px.bar(
101+
sales_by_hour,
102+
x=sales_by_hour.index,
103+
y="Total",
104+
title="<b>Sales by hour</b>",
105+
color_discrete_sequence=["#0083B8"] * len(sales_by_hour),
106+
template="plotly_white",
107+
)
108+
fig_hourly_sales.update_layout(
109+
xaxis=dict(tickmode="linear"),
110+
plot_bgcolor="rgba(0,0,0,0)",
111+
yaxis=(dict(showgrid=False)),
112+
)
113+
114+
115+
left_column, right_column = st.columns(2)
116+
left_column.plotly_chart(fig_hourly_sales, use_container_width=True)
117+
right_column.plotly_chart(fig_product_sales, use_container_width=True)
118+
119+
120+
# ---- HIDE STREAMLIT STYLE ----
121+
hide_st_style = """
122+
<style>
123+
#MainMenu {visibility: hidden;}
124+
footer {visibility: hidden;}
125+
header {visibility: hidden;}
126+
</style>
127+
"""
128+
st.markdown(hide_st_style, unsafe_allow_html=True)

β€Žpages/3_πŸ“Š_mrcnn.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("MRCNN")
17+
"# πŸ“ˆ MRCNN"
18+
19+

β€Žpages/4_πŸ–₯️_jetson.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("Nvidia Jetson")
17+
"# πŸ“ˆ NVIDIA Jetson"

β€Žpages/5_🚌 _OpenVINO.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("Open VINO")
17+
"# πŸ“ˆ Open VINO"
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("Self Driving Car")
17+
"# πŸ“ˆ Self Driving Car"

β€Žpages/7_πŸ€–_probots.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import time
3+
import requests
4+
import pandas as pd
5+
import numpy as np
6+
7+
import streamlit as st
8+
import folium
9+
from streamlit_folium import st_folium
10+
import aspose.slides as slides
11+
12+
13+
st.set_page_config(page_title="streamlit-folium documentation",page_icon="πŸ“ˆ")
14+
15+
16+
# st.header("Probots")
17+
"# πŸ“ˆ Probots"

β€Žpages/supermarkt_sales.xlsx

122 KB
Binary file not shown.

β€Žrequirements.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
streamlit==1.11.0
2+
streamlit-authenticator==0.1.5
3+
streamlit-folium==0.6.14

0 commit comments

Comments
Β (0)