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