Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit.components.v1 import html
|
3 |
+
|
4 |
+
# Function to create responsive iframe HTML code
|
5 |
+
def create_responsive_iframe(url):
|
6 |
+
iframe_code = f"""
|
7 |
+
<style>
|
8 |
+
.iframe-container {{
|
9 |
+
position: relative;
|
10 |
+
width: 100%;
|
11 |
+
padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
|
12 |
+
}}
|
13 |
+
.iframe-container iframe {{
|
14 |
+
position: absolute;
|
15 |
+
top: 0;
|
16 |
+
left: 0;
|
17 |
+
width: 100%;
|
18 |
+
height: 100%;
|
19 |
+
border: none;
|
20 |
+
}}
|
21 |
+
</style>
|
22 |
+
<div class="iframe-container">
|
23 |
+
<iframe src="{url}"></iframe>
|
24 |
+
</div>
|
25 |
+
"""
|
26 |
+
return iframe_code
|
27 |
+
|
28 |
+
# Streamlit interface
|
29 |
+
st.title("Gesture Recognizer Demo")
|
30 |
+
|
31 |
+
# URL input
|
32 |
+
url = st.text_input("Enter the URL for the iframe",
|
33 |
+
"https://mediapipe-studio.webapps.google.com/studio/demo/gesture_recognizer")
|
34 |
+
|
35 |
+
# Display the responsive iframe
|
36 |
+
iframe_html = create_responsive_iframe(url)
|
37 |
+
html(iframe_html, height=800) # Adjust the height as needed
|