Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
def main():
|
| 4 |
+
# Set page configuration
|
| 5 |
+
st.set_page_config(
|
| 6 |
+
page_title="Flashlight App",
|
| 7 |
+
page_icon="🔦",
|
| 8 |
+
layout="centered",
|
| 9 |
+
initial_sidebar_state="collapsed"
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
# Add some styling to simulate a flashlight effect
|
| 13 |
+
st.markdown(
|
| 14 |
+
"""
|
| 15 |
+
<style>
|
| 16 |
+
.light-mode {
|
| 17 |
+
background-color: white;
|
| 18 |
+
color: black;
|
| 19 |
+
height: 100vh;
|
| 20 |
+
display: flex;
|
| 21 |
+
justify-content: center;
|
| 22 |
+
align-items: center;
|
| 23 |
+
}
|
| 24 |
+
.dark-mode {
|
| 25 |
+
background-color: black;
|
| 26 |
+
color: white;
|
| 27 |
+
height: 100vh;
|
| 28 |
+
display: flex;
|
| 29 |
+
justify-content: center;
|
| 30 |
+
align-items: center;
|
| 31 |
+
}
|
| 32 |
+
</style>
|
| 33 |
+
""",
|
| 34 |
+
unsafe_allow_html=True
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
# Sidebar toggle
|
| 38 |
+
mode = st.sidebar.radio("Toggle Mode", ["Light", "Dark"])
|
| 39 |
+
|
| 40 |
+
if mode == "Light":
|
| 41 |
+
st.markdown('<div class="light-mode"><h1>🔦 Flashlight is ON</h1></div>', unsafe_allow_html=True)
|
| 42 |
+
else:
|
| 43 |
+
st.markdown('<div class="dark-mode"><h1>🌙 Flashlight is OFF</h1></div>', unsafe_allow_html=True)
|
| 44 |
+
|
| 45 |
+
if __name__ == "__main__":
|
| 46 |
+
main()
|
| 47 |
+
|