Spaces:
Sleeping
Sleeping
Rename run.py to app.py
Browse files- run.py → app.py +63 -21
run.py → app.py
RENAMED
|
@@ -4,8 +4,19 @@ 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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def interface():
|
| 8 |
with gr.Blocks(css="static/styles.css") as demo:
|
|
|
|
| 9 |
# Layout with a Row to hold buttons and content
|
| 10 |
with gr.Row():
|
| 11 |
with gr.Column(scale=1, elem_classes=["menu-column"]):
|
|
@@ -23,31 +34,62 @@ def interface():
|
|
| 23 |
yoga_video_content = yoga_position_from_video()
|
| 24 |
|
| 25 |
# Set initial visibility
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
# Button click handlers
|
| 32 |
-
def show_page(
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
return demo
|
| 50 |
|
| 51 |
|
| 52 |
if __name__ == "__main__":
|
| 53 |
-
interface().launch()
|
|
|
|
| 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 |
|
| 7 |
+
def main(page):
|
| 8 |
+
if page == "Home":
|
| 9 |
+
return home_page()
|
| 10 |
+
elif page == "About us":
|
| 11 |
+
return about_page()
|
| 12 |
+
elif page == "Yoga from stream":
|
| 13 |
+
return yoga_position_from_stream()
|
| 14 |
+
elif page == "Yoga from video":
|
| 15 |
+
return yoga_position_from_video()
|
| 16 |
+
|
| 17 |
def interface():
|
| 18 |
with gr.Blocks(css="static/styles.css") as demo:
|
| 19 |
+
|
| 20 |
# Layout with a Row to hold buttons and content
|
| 21 |
with gr.Row():
|
| 22 |
with gr.Column(scale=1, elem_classes=["menu-column"]):
|
|
|
|
| 34 |
yoga_video_content = yoga_position_from_video()
|
| 35 |
|
| 36 |
# Set initial visibility
|
| 37 |
+
home_page_content.visible = True
|
| 38 |
+
about_page_content.visible = False
|
| 39 |
+
yoga_stream_content.visible = False
|
| 40 |
+
yoga_video_content.visible = False
|
| 41 |
|
| 42 |
# Button click handlers
|
| 43 |
+
def show_page(page):
|
| 44 |
+
return [
|
| 45 |
+
gr.update(visible=(content == page))
|
| 46 |
+
for content in [
|
| 47 |
+
home_page_content,
|
| 48 |
+
about_page_content,
|
| 49 |
+
yoga_stream_content,
|
| 50 |
+
yoga_video_content,
|
| 51 |
+
]
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
home_button.click(
|
| 55 |
+
lambda: show_page(home_page_content),
|
| 56 |
+
outputs=[
|
| 57 |
+
home_page_content,
|
| 58 |
+
about_page_content,
|
| 59 |
+
yoga_stream_content,
|
| 60 |
+
yoga_video_content,
|
| 61 |
+
],
|
| 62 |
+
)
|
| 63 |
+
about_button.click(
|
| 64 |
+
lambda: show_page(about_page_content),
|
| 65 |
+
outputs=[
|
| 66 |
+
home_page_content,
|
| 67 |
+
about_page_content,
|
| 68 |
+
yoga_stream_content,
|
| 69 |
+
yoga_video_content,
|
| 70 |
+
],
|
| 71 |
+
)
|
| 72 |
+
yoga_stream_button.click(
|
| 73 |
+
lambda: show_page(yoga_stream_content),
|
| 74 |
+
outputs=[
|
| 75 |
+
home_page_content,
|
| 76 |
+
about_page_content,
|
| 77 |
+
yoga_stream_content,
|
| 78 |
+
yoga_video_content,
|
| 79 |
+
],
|
| 80 |
+
)
|
| 81 |
+
yoga_video_button.click(
|
| 82 |
+
lambda: show_page(yoga_video_content),
|
| 83 |
+
outputs=[
|
| 84 |
+
home_page_content,
|
| 85 |
+
about_page_content,
|
| 86 |
+
yoga_stream_content,
|
| 87 |
+
yoga_video_content,
|
| 88 |
+
],
|
| 89 |
+
)
|
| 90 |
|
| 91 |
return demo
|
| 92 |
|
| 93 |
|
| 94 |
if __name__ == "__main__":
|
| 95 |
+
interface().launch(share=True)
|