Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,55 +1,77 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
-
#
|
| 5 |
st.set_page_config(
|
| 6 |
-
page_title="Social Media
|
| 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 |
-
"Chatbot"
|
| 23 |
-
])
|
| 24 |
-
st.markdown(
|
| 25 |
-
"""
|
| 26 |
-
<style>
|
| 27 |
-
[data-testid="stSidebarNav"] {
|
| 28 |
-
display: none;
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
</style>
|
| 32 |
-
""",
|
| 33 |
-
unsafe_allow_html=True,
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
# Dynamically load pages
|
| 37 |
pages_dir = Path("pages")
|
| 38 |
-
page_files = {
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
|
| 54 |
# import streamlit as st
|
| 55 |
# from pathlib import Path
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from pathlib import Path
|
| 3 |
|
| 4 |
+
# Set page configuration at the very beginning
|
| 5 |
st.set_page_config(
|
| 6 |
+
page_title="Social Media Insights Dashboard",
|
| 7 |
page_icon="๐",
|
| 8 |
+
layout="wide"
|
|
|
|
| 9 |
)
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Dynamically load pages
|
| 12 |
pages_dir = Path("pages")
|
| 13 |
+
page_files = {i: f for i, f in enumerate(sorted(pages_dir.glob("*.py")))}
|
| 14 |
+
|
| 15 |
+
# Sidebar for navigation
|
| 16 |
+
page = st.sidebar.selectbox("Select a Page", list(page_files.keys()), format_func=lambda x: page_files[x].stem)
|
| 17 |
+
|
| 18 |
+
# Execute the selected page script
|
| 19 |
+
exec(open(pages_dir / page_files[page]).read())
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
# import streamlit as st
|
| 24 |
+
# from pathlib import Path
|
| 25 |
+
|
| 26 |
+
# # Configure page settings
|
| 27 |
+
# st.set_page_config(
|
| 28 |
+
# page_title="Social Media Addiction Insights",
|
| 29 |
+
# page_icon="๐",
|
| 30 |
+
# layout="wide",
|
| 31 |
+
# initial_sidebar_state="expanded"
|
| 32 |
+
# )
|
| 33 |
+
|
| 34 |
+
# # Sidebar navigation
|
| 35 |
+
# st.sidebar.title("Navigation")
|
| 36 |
+
# page = st.sidebar.radio("Go to", [
|
| 37 |
+
# "Overview",
|
| 38 |
+
# "Platform Usage Patterns",
|
| 39 |
+
# "Video Consumption Insights",
|
| 40 |
+
# "Socioeconomic Analysis",
|
| 41 |
+
# "Addiction and Satisfaction",
|
| 42 |
+
# "Activity and Connection Type",
|
| 43 |
+
# "Advanced Analytics",
|
| 44 |
+
# "Chatbot"
|
| 45 |
+
# ])
|
| 46 |
+
# st.markdown(
|
| 47 |
+
# """
|
| 48 |
+
# <style>
|
| 49 |
+
# [data-testid="stSidebarNav"] {
|
| 50 |
+
# display: none;
|
| 51 |
+
# }
|
| 52 |
+
|
| 53 |
+
# </style>
|
| 54 |
+
# """,
|
| 55 |
+
# unsafe_allow_html=True,
|
| 56 |
+
# )
|
| 57 |
+
|
| 58 |
+
# # Dynamically load pages
|
| 59 |
+
# pages_dir = Path("pages")
|
| 60 |
+
# page_files = {
|
| 61 |
+
# "Overview": "overview.py",
|
| 62 |
+
# "Platform Usage Patterns": "platform_usage.py",
|
| 63 |
+
# "Video Consumption Insights": "video_insights.py",
|
| 64 |
+
# "Socioeconomic Analysis": "socioeconomic.py",
|
| 65 |
+
# "Addiction and Satisfaction": "addiction.py",
|
| 66 |
+
# "Activity and Connection Type": "activity.py",
|
| 67 |
+
# "Advanced Analytics": "advanced.py",
|
| 68 |
+
# "Chatbot": "chatbot.py"
|
| 69 |
+
# }
|
| 70 |
+
|
| 71 |
+
# if page in page_files:
|
| 72 |
+
# exec(open(pages_dir / page_files[page]).read())
|
| 73 |
+
# else:
|
| 74 |
+
# st.error("Page not found!")
|
| 75 |
|
| 76 |
# import streamlit as st
|
| 77 |
# from pathlib import Path
|