-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
129 lines (118 loc) · 3.7 KB
/
Copy pathapp.py
File metadata and controls
129 lines (118 loc) · 3.7 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import streamlit as st
import pandas as pd
import base64
# Function to convert image to base64
def get_base64_of_image(img_path):
with open(img_path, "rb") as img_file:
return base64.b64encode(img_file.read()).decode()
# Set page config
st.set_page_config(
page_title="Amazon Sales Dashboard",
page_icon="📊",
layout="wide",
)
# Initialize session state for filters
if 'selected_state' not in st.session_state:
st.session_state.selected_state = 'All'
if 'selected_month' not in st.session_state:
st.session_state.selected_month = 'All'
if 'selected_day' not in st.session_state:
st.session_state.selected_day = 'All'
# Try to load the background image
try:
# Update this path to match your actual file location
img_path = ".\streamlit\static\powerBISalesDashboard-banner.jpg"
img_base64 = get_base64_of_image(img_path)
# Custom CSS with base64 image
st.markdown(f"""
<style>
.metric-container {{
background-color: #f0f2f6;
padding: 20px;
border-radius: 10px;
margin: 10px 0;
}}
.stTabs [data-baseweb="tab-list"] {{
gap: 8px;
}}
.stTabs [data-baseweb="tab"] {{
height: 50px;
padding-left: 20px;
padding-right: 20px;
}}
.main-header {{
background-image: url("data:image/jpeg;base64,{img_base64}");
background-size: cover;
background-position: center;
padding: 50px 20px;
text-align: center;
color: white;
border-radius: 10px;
margin-bottom: 20px;
}}
.main-header h1 {{
padding: 20px;
border-radius: 10px;
display: inline-block;
}}
</style>
""", unsafe_allow_html=True)
except:
# Fallback CSS without background image
st.markdown("""
<style>
.metric-container {
background-color: #f0f2f6;
padding: 20px;
border-radius: 10px;
margin: 10px 0;
}
.stTabs [data-baseweb="tab-list"] {
gap: 8px;
}
.stTabs [data-baseweb="tab"] {
height: 50px;
padding-left: 20px;
padding-right: 20px;
}
.main-header {
background-color: #1f4788;
padding: 50px 20px;
text-align: center;
color: white;
border-radius: 10px;
margin-bottom: 20px;
}
</style>
""", unsafe_allow_html=True)
# Title with background
st.markdown("""
<div class="main-header">
<h1>🛍️ Amazon Sales Dashboard</h1>
</div>
""", unsafe_allow_html=True)
st.markdown("---")
# Sidebar navigation
st.sidebar.title("Navigation")
page = st.sidebar.radio(
"Go to",
["🏠 Home", "🗺️ Geographic Analysis", "📅 Time Analysis", "🛍️ Product & Customer Analysis"]
)
# Route to appropriate page
if page == "🏠 Home":
from pages_files.home import show_home_page
show_home_page()
elif page == "🗺️ Geographic Analysis":
from pages_files.geographic_analysis import show_geographic_analysis
show_geographic_analysis()
elif page == "📅 Time Analysis":
from pages_files.time_analysis import show_time_analysis
show_time_analysis()
elif page == "🛍️ Product & Customer Analysis":
from pages_files.product_customer_analysis import show_product_customer_analysis
show_product_customer_analysis()
# Footer
st.markdown("---")
st.markdown("📊 Amazon Sales Dashboard || Data Analysis Project || By IBRAHIM SABER")
st.markdown("https://github.com/ibrahimsaber1")
st.markdown("Github repo Link===> https://github.com/ibrahimsaber1/Amazon-Sales-Analysis")