DS2 commited on
Commit
fe746fc
·
verified ·
1 Parent(s): 380ed97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +143 -0
app.py CHANGED
@@ -2,7 +2,150 @@ import streamlit as st
2
  import random
3
  import requests
4
  from streamlit_lottie import st_lottie
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Set page config to wide layout and remove top padding
7
  st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
8
 
 
2
  import random
3
  import requests
4
  from streamlit_lottie import st_lottie
5
+ import streamlit as st
6
+ import streamlit.components.v1 as stc
7
+ import requests
8
+ from streamlit_lottie import st_lottie
9
+
10
+ def load_lottieurl(url: str):
11
+ r = requests.get(url)
12
+ if r.status_code != 200:
13
+ return None
14
+ return r.json()
15
+
16
+ # Load the Lottie animation
17
+ lottie_hello = load_lottieurl("https://lottie.host/d29edbdd-af94-402e-bb4c-b314f17897e6/n5SKHOkbYQ.json")
18
+
19
+ # Set the page title and layout
20
+ st.set_page_config(page_title="Space Birthday Exploration", page_icon="🚀", layout="wide")
21
+
22
+ # Add CSS styles to the page
23
+ st.markdown(
24
+ """
25
+ <style>
26
+ @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap');
27
+
28
+ body {
29
+ background-color: #000011;
30
+ background-image:
31
+ radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
32
+ radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
33
+ radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px),
34
+ radial-gradient(rgba(255,255,255,.4), rgba(255,255,255,.1) 2px, transparent 30px);
35
+ background-size: 550px 550px, 350px 350px, 250px 250px, 150px 150px;
36
+ background-position: 0 0, 40px 60px, 130px 270px, 70px 100px;
37
+ animation: backgroundScroll 60s linear infinite;
38
+ }
39
+
40
+ @keyframes backgroundScroll {
41
+ 0% {background-position: 0 0, 40px 60px, 130px 270px, 70px 100px;}
42
+ 100% {background-position: 550px 550px, 590px 610px, 680px 820px, 620px 650px;}
43
+ }
44
+
45
+ .stApp {
46
+ background: transparent;
47
+ }
48
+
49
+ .content-container {
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: center;
53
+ justify-content: flex-start;
54
+ min-height: 100vh;
55
+ padding: 20px;
56
+ }
57
+
58
+ .birthday-text {
59
+ font-size: 48px;
60
+ font-weight: bold;
61
+ color: #FFB6C1;
62
+ font-family: 'Orbitron', sans-serif;
63
+ text-shadow: 0 0 10px #FFB6C1, 0 0 20px #FFB6C1, 0 0 30px #FFB6C1;
64
+ animation: birthday-glow 2s ease-in-out infinite alternate;
65
+ margin-top: 20px;
66
+ margin-bottom: 30px;
67
+ }
68
+
69
+ @keyframes birthday-glow {
70
+ from {
71
+ text-shadow: 0 0 10px #FFB6C1, 0 0 20px #FFB6C1, 0 0 30px #FFB6C1;
72
+ }
73
+ to {
74
+ text-shadow: 0 0 20px #FFB6C1, 0 0 30px #FFB6C1, 0 0 40px #FFB6C1, 0 0 50px #FFB6C1;
75
+ }
76
+ }
77
+
78
+ .video-container {
79
+ width: 80%;
80
+ height: 450px;
81
+ border-radius: 20px;
82
+ box-shadow: 0px 0px 20px rgba(255,255,255,0.3);
83
+ overflow: hidden;
84
+ margin-bottom: 30px;
85
+ }
86
+
87
+ .lottie-container {
88
+ width: 200px;
89
+ height: 200px;
90
+ margin-bottom: 30px;
91
+ }
92
+
93
+ .space-text {
94
+ font-size: 24px;
95
+ font-weight: bold;
96
+ color: #fff;
97
+ font-family: 'Orbitron', sans-serif;
98
+ text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
99
+ animation: glow 2s ease-in-out infinite alternate;
100
+ }
101
+
102
+ @keyframes glow {
103
+ from {
104
+ text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
105
+ }
106
+ to {
107
+ text-shadow: 0 0 20px #00ffff, 0 0 30px #00ffff, 0 0 40px #00ffff, 0 0 50px #00ffff;
108
+ }
109
+ }
110
+ </style>
111
+ """,
112
+ unsafe_allow_html=True
113
+ )
114
+
115
+ # Create a container for all content
116
+ st.markdown('<div class="content-container">', unsafe_allow_html=True)
117
 
118
+ # Add birthday text at the top
119
+ st.markdown('<div class="birthday-text">Happy Birthday!</div>', unsafe_allow_html=True)
120
+
121
+ # Create a YouTube video embed
122
+ video_id = "your_youtube_video_id_here" # Replace with your YouTube video ID
123
+ video_embed = f"""
124
+ <div class="video-container">
125
+ <iframe width="100%" height="100%" src="https://www.youtube.com/embed/{video_id}" frameborder="0" allowfullscreen>
126
+ </iframe>
127
+ </div>
128
+ """
129
+
130
+ # Add the video embed
131
+ st.markdown(video_embed, unsafe_allow_html=True)
132
+
133
+ # Add the Lottie animation
134
+ st.markdown('<div class="lottie-container">', unsafe_allow_html=True)
135
+ st_lottie(
136
+ lottie_hello,
137
+ speed=1,
138
+ reverse=False,
139
+ loop=True,
140
+ quality="low",
141
+ key=None,
142
+ )
143
+ st.markdown('</div>', unsafe_allow_html=True)
144
+
145
+ # Add space-themed text
146
+ st.markdown('<div class="space-text">Explore the Wonders of Space!</div>', unsafe_allow_html=True)
147
+
148
+ st.markdown('</div>', unsafe_allow_html=True)
149
  # Set page config to wide layout and remove top padding
150
  st.set_page_config(layout="wide", initial_sidebar_state="collapsed")
151