1mpreccable commited on
Commit
b6d9a34
·
verified ·
1 Parent(s): 772eda6

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +134 -0
  2. static/styles.css +201 -0
app.py ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from interface_pages.home_page import home_page
3
+ from interface_pages.about_page import about_page
4
+ from interface_pages.yoga_position_from_stream import yoga_position_from_stream
5
+ from interface_pages.yoga_position_from_video import yoga_position_from_video
6
+ import time
7
+
8
+
9
+ def main(page):
10
+ if page == "Home":
11
+ return home_page()
12
+ elif page == "About us":
13
+ return about_page()
14
+ elif page == "Yoga from stream":
15
+ return yoga_position_from_stream()
16
+ elif page == "Yoga from video":
17
+ return yoga_position_from_video()
18
+
19
+
20
+ def interface():
21
+ css_version = int(time.time()) # Use current timestamp as version
22
+ with gr.Blocks(css=f"static/styles.css?v={css_version}") as demo:
23
+ # ASCII Logo at the top with inline gradient style
24
+ ascii_logo = """
25
+ ___ ___ ___
26
+ /\ \ /\__\ /\ \
27
+ ___ /::\ \ /:/ _/_ /::\ \ ___
28
+ /| | /:/\:\ \ /:/ /\ \ /:/\:\ \ /\__\
29
+ |:| | /:/ \:\ \ /:/ /::\ \ /:/ /::\ \ /:/__/
30
+ |:| | /:/__/ \:\__\ /:/__\/\:\__\ /:/_/:/\:\__\ /::\ \
31
+ __|:|__| \:\ \ /:/ / \:\ \ /:/ / \:\/:/ \/__/ \/\:\ \__
32
+ /::::\ \ \:\ /:/ / \:\ /:/ / \::/__/ ~~\:\/\__\\
33
+ ~~~~\:\ \ \:\/:/ / \:\/:/ / \:\ \ \::/ /
34
+ \:\__\ \::/ / \::/ / \:\__\ /:/ /
35
+ \/__/ \/__/ \/__/ \/__/ \/__/
36
+ """
37
+ gr.HTML(
38
+ f"""
39
+ <div class="ascii-logo-container" style="display: flex; justify-content: center; width: 100%;">
40
+ <pre class="ascii-logo" style="
41
+ font-family: monospace;
42
+ font-size: 2.1em;
43
+ line-height: 1.2;
44
+ white-space: pre;
45
+ text-align: center;
46
+ background: linear-gradient(to right, #7dc4e4, #c6a0f6);
47
+ -webkit-background-clip: text;
48
+ -webkit-text-fill-color: transparent;
49
+ display: inline-block;
50
+ ">{ascii_logo}</pre>
51
+ </div>
52
+ """
53
+ )
54
+
55
+ # Layout with a Row to hold buttons and content
56
+ with gr.Row():
57
+ with gr.Column(scale=1, elem_classes=["menu-column"]):
58
+ # Vertical Navigation Buttons
59
+ home_button = gr.Button("Home", elem_classes=["menu-button"])
60
+ about_button = gr.Button("About us", elem_classes=["menu-button"])
61
+ yoga_stream_button = gr.Button(
62
+ "Yoga from stream", elem_classes=["menu-button"]
63
+ )
64
+ yoga_video_button = gr.Button(
65
+ "Yoga from video", elem_classes=["menu-button"]
66
+ )
67
+
68
+ # Create page contents
69
+ with gr.Column(elem_id="page-content") as page_content:
70
+ home_page_content = home_page()
71
+ about_page_content = about_page()
72
+ yoga_stream_content = yoga_position_from_stream()
73
+ yoga_video_content = yoga_position_from_video()
74
+
75
+ # Set initial visibility
76
+ home_page_content.visible = True
77
+ about_page_content.visible = False
78
+ yoga_stream_content.visible = False
79
+ yoga_video_content.visible = False
80
+
81
+ # Button click handlers
82
+ def show_page(page):
83
+ return [
84
+ gr.update(visible=(content == page))
85
+ for content in [
86
+ home_page_content,
87
+ about_page_content,
88
+ yoga_stream_content,
89
+ yoga_video_content,
90
+ ]
91
+ ]
92
+
93
+ home_button.click(
94
+ lambda: show_page(home_page_content),
95
+ outputs=[
96
+ home_page_content,
97
+ about_page_content,
98
+ yoga_stream_content,
99
+ yoga_video_content,
100
+ ],
101
+ )
102
+ about_button.click(
103
+ lambda: show_page(about_page_content),
104
+ outputs=[
105
+ home_page_content,
106
+ about_page_content,
107
+ yoga_stream_content,
108
+ yoga_video_content,
109
+ ],
110
+ )
111
+ yoga_stream_button.click(
112
+ lambda: show_page(yoga_stream_content),
113
+ outputs=[
114
+ home_page_content,
115
+ about_page_content,
116
+ yoga_stream_content,
117
+ yoga_video_content,
118
+ ],
119
+ )
120
+ yoga_video_button.click(
121
+ lambda: show_page(yoga_video_content),
122
+ outputs=[
123
+ home_page_content,
124
+ about_page_content,
125
+ yoga_stream_content,
126
+ yoga_video_content,
127
+ ],
128
+ )
129
+
130
+ return demo
131
+
132
+
133
+ if __name__ == "__main__":
134
+ interface().launch(share=True)
static/styles.css ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --rosewater: #f4dbd6;
3
+ --flamingo: #f0c6c6;
4
+ --pink: #f5bde6;
5
+ --mauve: #c6a0f6;
6
+ --red: #ed8796;
7
+ --maroon: #ee99a0;
8
+ --peach: #f5a97f;
9
+ --yellow: #eed49f;
10
+ --green: #a6da95;
11
+ --teal: #8bd5ca;
12
+ --sky: #91d7e3;
13
+ --sapphire: #7dc4e4;
14
+ --blue: #8aadf4;
15
+ --lavender: #b7bdf8;
16
+ --text: #cad3f5;
17
+ --subtext1: #b8c0e0;
18
+ --subtext0: #a5adcb;
19
+ --overlay2: #939ab7;
20
+ --overlay1: #8087a2;
21
+ --overlay0: #6e738d;
22
+ --surface2: #5b6078;
23
+ --surface1: #494d64;
24
+ --surface0: #363a4f;
25
+ --base: #24273a;
26
+ --mantle: #1e2030;
27
+ --crust: #181926;
28
+ }
29
+
30
+ body {
31
+ background-color: var(--base);
32
+ color: var(--text);
33
+ font-family: 'Inter', sans-serif;
34
+ }
35
+
36
+ .gradio-container {
37
+ background-color: rgba(36, 39, 58, 0.7) !important;
38
+ }
39
+
40
+ /* ASCII Logo Styling */
41
+ .ascii-logo-container {
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ width: 100%;
46
+ margin-bottom: 20px;
47
+ padding: 20px 0;
48
+ background: rgba(54, 58, 79, 0.3);
49
+ backdrop-filter: blur(10px);
50
+ -webkit-backdrop-filter: blur(10px);
51
+ }
52
+
53
+ .ascii-logo {
54
+ font-family: monospace;
55
+ font-size: 0.7em;
56
+ line-height: 1.2;
57
+ white-space: pre;
58
+ text-align: center;
59
+ background: linear-gradient(to right, #7dc4e4, #c6a0f6);
60
+ -webkit-background-clip: text;
61
+ -webkit-text-fill-color: transparent;
62
+ display: inline-block;
63
+ }
64
+
65
+ .gradio-container .menu-column {
66
+ background: rgba(54, 58, 79, 0.3) !important;
67
+ backdrop-filter: blur(10px);
68
+ -webkit-backdrop-filter: blur(10px);
69
+ border-right: 1px solid rgba(255, 255, 255, 0.1);
70
+ padding: 20px;
71
+ height: 100vh;
72
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
73
+ }
74
+
75
+ .gradio-container .menu-button {
76
+ color: var(--text) !important;
77
+ background: rgba(73, 77, 100, 0.3) !important;
78
+ backdrop-filter: blur(10px);
79
+ -webkit-backdrop-filter: blur(10px);
80
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
81
+ padding: 15px 20px !important;
82
+ width: 80% !important;
83
+ margin-left: 10% !important;
84
+ text-align: center !important;
85
+ cursor: pointer !important;
86
+ transition: all 0.3s ease !important;
87
+ margin-bottom: 15px !important;
88
+ border-radius: 25px !important;
89
+ font-size: 1.2em !important;
90
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
91
+ }
92
+
93
+ .gradio-container .menu-button:hover {
94
+ background: rgba(91, 96, 120, 0.5) !important;
95
+ color: var(--subtext1) !important;
96
+ transform: translateY(-2px) !important;
97
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15) !important;
98
+ }
99
+
100
+ .gradio-container .gr-button-primary {
101
+ background: rgba(138, 173, 244, 0.3) !important;
102
+ backdrop-filter: blur(10px);
103
+ -webkit-backdrop-filter: blur(10px);
104
+ color: var(--text) !important;
105
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
106
+ border-radius: 25px !important;
107
+ padding: 12px 24px !important;
108
+ font-size: 1.2em !important;
109
+ transition: all 0.3s ease !important;
110
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
111
+ }
112
+
113
+ .gradio-container .gr-button-secondary {
114
+ background: rgba(73, 77, 100, 0.3) !important;
115
+ backdrop-filter: blur(10px);
116
+ -webkit-backdrop-filter: blur(10px);
117
+ color: var(--text) !important;
118
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
119
+ border-radius: 25px !important;
120
+ padding: 12px 24px !important;
121
+ font-size: 1.2em !important;
122
+ transition: all 0.3s ease !important;
123
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
124
+ }
125
+
126
+ .gradio-container .gr-button-primary:hover,
127
+ .gradio-container .gr-button-secondary:hover {
128
+ transform: translateY(-2px) !important;
129
+ box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15) !important;
130
+ background: rgba(91, 96, 120, 0.5) !important;
131
+ }
132
+
133
+ .gradio-container .gr-input,
134
+ .gradio-container .gr-textarea {
135
+ background: rgba(54, 58, 79, 0.3) !important;
136
+ backdrop-filter: blur(10px);
137
+ -webkit-backdrop-filter: blur(10px);
138
+ color: var(--text) !important;
139
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
140
+ border-radius: 12px !important;
141
+ transition: all 0.3s ease !important;
142
+ }
143
+
144
+ .gradio-container .gr-input:focus,
145
+ .gradio-container .gr-textarea:focus {
146
+ border-color: rgba(138, 173, 244, 0.6) !important;
147
+ box-shadow: 0 0 0 2px rgba(138, 173, 244, 0.3) !important;
148
+ }
149
+
150
+ .gradio-container .gr-form {
151
+ background: rgba(54, 58, 79, 0.3) !important;
152
+ backdrop-filter: blur(10px);
153
+ -webkit-backdrop-filter: blur(10px);
154
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
155
+ border-radius: 16px !important;
156
+ padding: 20px !important;
157
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
158
+ }
159
+
160
+ .gradio-container .gr-box {
161
+ background: rgba(73, 77, 100, 0.3) !important;
162
+ backdrop-filter: blur(10px);
163
+ -webkit-backdrop-filter: blur(10px);
164
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
165
+ border-radius: 16px !important;
166
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
167
+ }
168
+
169
+ .gradio-container .gr-panel {
170
+ background: rgba(54, 58, 79, 0.3) !important;
171
+ backdrop-filter: blur(10px);
172
+ -webkit-backdrop-filter: blur(10px);
173
+ border: 1px solid rgba(255, 255, 255, 0.1) !important;
174
+ border-radius: 16px !important;
175
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1) !important;
176
+ }
177
+
178
+ /* Scrollbar styling */
179
+ .gradio-container ::-webkit-scrollbar {
180
+ width: 10px;
181
+ }
182
+
183
+ .gradio-container ::-webkit-scrollbar-track {
184
+ background: rgba(54, 58, 79, 0.3);
185
+ }
186
+
187
+ .gradio-container ::-webkit-scrollbar-thumb {
188
+ background: rgba(110, 115, 141, 0.5);
189
+ border-radius: 5px;
190
+ }
191
+
192
+ .gradio-container ::-webkit-scrollbar-thumb:hover {
193
+ background: rgba(128, 135, 162, 0.7);
194
+ }
195
+
196
+ /* Media query for larger screens */
197
+ @media (min-width: 1200px) {
198
+ .ascii-logo {
199
+ font-size: 1em;
200
+ }
201
+ }