Ashar086 commited on
Commit
132ef4f
·
verified ·
1 Parent(s): ec1d92f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -14
app.py CHANGED
@@ -1,28 +1,42 @@
1
- from st_pages import Page, show_pages
2
- from pathlib import Path
3
  import streamlit as st
 
4
 
5
  # Configure page settings
6
  st.set_page_config(
7
- page_title="Social Media Insights Dashboard",
8
  page_icon="📊",
9
  layout="wide",
10
  initial_sidebar_state="expanded"
11
  )
12
 
13
- # Manually define pages (prevents Streamlit from auto-listing)
14
- show_pages([
15
- Page("app.py", "Home"),
16
- Page("pages/overview.py", "Overview"),
17
- Page("pages/platform_usage.py", "Platform Usage Patterns"),
18
- Page("pages/video_insights.py", "Video Consumption Insights"),
19
- Page("pages/socioeconomic.py", "Socioeconomic Analysis"),
20
- Page("pages/addiction.py", "Addiction and Satisfaction"),
21
- Page("pages/activity.py", "Activity and Connection Type"),
22
- Page("pages/advanced.py", "Advanced Analytics")
23
-
24
  ])
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # import streamlit as st
28
  # from pathlib import Path
 
 
 
1
  import streamlit as st
2
+ from pathlib import Path
3
 
4
  # Configure page settings
5
  st.set_page_config(
6
+ page_title="Social Media Addiction Insights",
7
  page_icon="📊",
8
  layout="wide",
9
  initial_sidebar_state="expanded"
10
  )
11
 
12
+ # Sidebar navigation
13
+ st.sidebar.title("Navigation")
14
+ page = st.sidebar.radio("Go to", [
15
+ "Overview",
16
+ "Platform Usage Patterns",
17
+ "Video Consumption Insights",
18
+ "Socioeconomic Analysis",
19
+ "Addiction and Satisfaction",
20
+ "Activity and Connection Type",
21
+ "Advanced Analytics"
 
22
  ])
23
 
24
+ # Dynamically load pages
25
+ pages_dir = Path("pages")
26
+ page_files = {
27
+ "Overview": "overview.py",
28
+ "Platform Usage Patterns": "platform_usage.py",
29
+ "Video Consumption Insights": "video_insights.py",
30
+ "Socioeconomic Analysis": "socioeconomic.py",
31
+ "Addiction and Satisfaction": "addiction.py",
32
+ "Activity and Connection Type": "activity.py",
33
+ "Advanced Analytics": "advanced.py"
34
+ }
35
+
36
+ if page in page_files:
37
+ exec(open(pages_dir / page_files[page]).read())
38
+ else:
39
+ st.error("Page not found!")
40
 
41
  # import streamlit as st
42
  # from pathlib import Path