DS2 commited on
Commit
a5dc387
·
verified ·
1 Parent(s): 85bd90b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +131 -103
app.py CHANGED
@@ -1,6 +1,14 @@
1
  import streamlit as st
2
  import requests
3
  from streamlit_lottie import st_lottie
 
 
 
 
 
 
 
 
4
 
5
  # Set the page title and layout
6
  st.set_page_config(page_title="Space Birthday Exploration", page_icon="🚀", layout="centered")
@@ -14,106 +22,126 @@ def load_lottieurl(url: str):
14
  # Load the Lottie animation
15
  lottie_hello = load_lottieurl("https://lottie.host/d29edbdd-af94-402e-bb4c-b314f17897e6/n5SKHOkbYQ.json")
16
 
17
- # Custom styles with the background image and updated shadow effect
18
- st.markdown(
19
- """
20
- <style>
21
- @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
22
-
23
- body {
24
- background-image: url('https://i.imghippo.com/files/nYbNv1725063923.png');
25
- background-size: cover;
26
- background-repeat: no-repeat;
27
- background-attachment: fixed;
28
- color: #FFFFFF;
29
- margin: 0;
30
- font-family: 'Orbitron', sans-serif;
31
- }
32
-
33
- .stApp {
34
- background: transparent;
35
- }
36
-
37
- .birthday-text {
38
- font-size: 48px;
39
- font-weight: bold;
40
- color: #FFB6C1;
41
- text-shadow: 0 0 10px #000000, 0 0 20px #000000, 0 0 30px #000000;
42
- text-align: center;
43
- margin-top: 20px;
44
- }
45
-
46
- .custom-text {
47
- font-size: 20px;
48
- text-align: center;
49
- margin-top: 10px;
50
- }
51
-
52
- .video-container {
53
- display: flex;
54
- justify-content: center;
55
- margin-top: 30px;
56
- box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
57
- border-radius: 10px;
58
- overflow: hidden;
59
- background-color: rgba(0,0,0,0); /* Fully transparent background */
60
- }
61
-
62
- .lottie-container {
63
- display: flex;
64
- justify-content: center;
65
- margin-top: 20px;
66
- margin-bottom: 20px;
67
- box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
68
- border-radius: 10px;
69
- background-color: rgba(0,0,0,0); /* Fully transparent background */
70
- width: 150px;
71
- height: 150px;
72
- }
73
-
74
- .space-text {
75
- font-size: 24px;
76
- font-weight: bold;
77
- color: #00FFFF;
78
- text-shadow: 0 0 10px #00FFFF, 0 0 20px #00FFFF, 0 0 30px #00FFFF;
79
- text-align: center;
80
- margin-top: 20px;
81
- margin-bottom: 20px;
82
- }
83
- </style>
84
- """,
85
- unsafe_allow_html=True
86
- )
87
-
88
- # Add "Happy Birthday!" text at the top
89
- st.markdown('<div class="birthday-text">Happy Birthday!</div>', unsafe_allow_html=True)
90
-
91
- # Add custom text after the heading
92
- custom_text = "Wishing you a day filled with love and happiness!" # You can change this text
93
- st.markdown(f'<div class="custom-text">{custom_text}</div>', unsafe_allow_html=True)
94
-
95
- # Embed the YouTube video with a transparent background
96
- video_id = "your_youtube_video_id_here" # Replace with your YouTube video ID
97
- st.markdown(
98
- f"""
99
- <div class="video-container">
100
- <iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allowfullscreen></iframe>
101
- </div>
102
- """,
103
- unsafe_allow_html=True
104
- )
105
-
106
- # Add the space-themed text after the video
107
- st.markdown('<div class="space-text">Explore the Wonders of Space!</div>', unsafe_allow_html=True)
108
-
109
- # Add the Lottie animation directly without extra container
110
- st_lottie(
111
- lottie_hello,
112
- speed=1,
113
- reverse=False,
114
- loop=True,
115
- quality="low",
116
- height=150,
117
- width=150,
118
- key=None,
119
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import requests
3
  from streamlit_lottie import st_lottie
4
+ from dotenv import load_dotenv
5
+ import os
6
+
7
+ # Load environment variables from .env file
8
+ load_dotenv()
9
+
10
+ # Retrieve the password from the environment variable
11
+ APP_PASSWORD = os.getenv("APP_PASSWORD")
12
 
13
  # Set the page title and layout
14
  st.set_page_config(page_title="Space Birthday Exploration", page_icon="🚀", layout="centered")
 
22
  # Load the Lottie animation
23
  lottie_hello = load_lottieurl("https://lottie.host/d29edbdd-af94-402e-bb4c-b314f17897e6/n5SKHOkbYQ.json")
24
 
25
+ # Function to display the login form
26
+ def login():
27
+ st.sidebar.header("Login")
28
+ password = st.sidebar.text_input("Password", type="password")
29
+ if st.sidebar.button("Submit"):
30
+ if password == APP_PASSWORD: # Compare entered password with the environment password
31
+ st.session_state["authenticated"] = True
32
+ else:
33
+ st.error("Incorrect password")
34
+
35
+ # Check authentication status
36
+ if "authenticated" not in st.session_state:
37
+ st.session_state["authenticated"] = False
38
+
39
+ if not st.session_state["authenticated"]:
40
+ login()
41
+ else:
42
+ # Custom styles with the background image and updated shadow effect
43
+ st.markdown(
44
+ """
45
+ <style>
46
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
47
+
48
+ body {
49
+ background-image: url('https://i.imghippo.com/files/nYbNv1725063923.png');
50
+ background-size: cover;
51
+ background-repeat: no-repeat;
52
+ background-attachment: fixed;
53
+ color: #FFFFFF;
54
+ margin: 0;
55
+ font-family: 'Orbitron', sans-serif;
56
+ }
57
+
58
+ .stApp {
59
+ background: transparent;
60
+ }
61
+
62
+ .birthday-text {
63
+ font-size: 48px;
64
+ font-weight: bold;
65
+ color: #FFB6C1;
66
+ text-shadow: 0 0 10px #000000, 0 0 20px #000000, 0 0 30px #000000;
67
+ text-align: center;
68
+ margin-top: 20px;
69
+ }
70
+
71
+ .custom-text {
72
+ font-size: 20px;
73
+ color: #FF00FF; /* Magenta color */
74
+ text-shadow: 0 0 10px #000000, 0 0 20px #000000, 0 0 30px #000000;
75
+ text-align: center;
76
+ margin-top: 10px;
77
+ }
78
+
79
+ .video-container {
80
+ display: flex;
81
+ justify-content: center;
82
+ margin-top: 30px;
83
+ box-shadow: 0px 0px 20px rgba(0,0,0,0.5);
84
+ border-radius: 10px;
85
+ overflow: hidden;
86
+ background-color: rgba(0,0,0,0); /* Fully transparent background */
87
+ }
88
+
89
+ .space-text {
90
+ font-size: 24px;
91
+ font-weight: bold;
92
+ color: #00FFFF;
93
+ text-shadow: 0 0 10px #00FFFF, 0 0 20px #00FFFF, 0 0 30px #00FFFF;
94
+ text-align: center;
95
+ margin-top: 20px;
96
+ margin-bottom: 20px;
97
+ }
98
+ </style>
99
+ """,
100
+ unsafe_allow_html=True
101
+ )
102
+
103
+ # Add "Happy Birthday!" text at the top
104
+ st.markdown('<div class="birthday-text">Happy Birthday!</div>', unsafe_allow_html=True)
105
+
106
+ # Add custom text after the heading, with two paragraphs
107
+ custom_text = """
108
+ <p>Wishing you many wonderful years ahead, filled with love, happiness, and out-of-this-world adventures, space girl!</p>
109
+ <p>Now let me present to you the bday vid edit "20thChondiEdit"</p>
110
+ <p>I hope you like it!</p>
111
+ """ # You can change this text
112
+ st.markdown(f'<div class="custom-text">{custom_text}</div>', unsafe_allow_html=True)
113
+
114
+ # Embed the YouTube video with a transparent background
115
+ video_id = "SLBzL4f7r3k" # Your YouTube video ID
116
+ st.markdown(
117
+ f"""
118
+ <div class="video-container">
119
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allowfullscreen></iframe>
120
+ </div>
121
+ """,
122
+ unsafe_allow_html=True
123
+ )
124
+
125
+ # Add the space-themed text after the video, with two paragraphs
126
+ space_text = """
127
+ <p>Hey dude that last 1 year was damn crazy but it was filled with many moments.</p>
128
+ <p>These are some of those moments that were captured.</p>
129
+ <p>In all these moments Ik I haven't always been the ideal best friend and I am truly sorry for those.</p>
130
+ <p>You have been a great friend all this time and am sorry for all those times I couldn't reciprocate that.</p>
131
+ <p>Seriously though thank you for being there for me and for taking all the messed up things that I do.</p>
132
+ <p>I haven't always been the bunny that you deserve but thank you for the aditi you have been.</p>
133
+ <p>So Happy Birthday! And I hope we stay like this for all your next bdays well just a lil bit more matured 🤓</p>
134
+ """ # You can change this text
135
+ st.markdown(f'<div class="space-text">{space_text}</div>', unsafe_allow_html=True)
136
+
137
+ # Add the Lottie animation directly without an extra container
138
+ st_lottie(
139
+ lottie_hello,
140
+ speed=1,
141
+ reverse=False,
142
+ loop=True,
143
+ quality="low",
144
+ height=150,
145
+ width=150,
146
+ key=None,
147
+ )