Spaces:
Sleeping
Sleeping
import streamlit as st | |
import streamlit.components.v1 as components | |
# Set page config for dark theme | |
st.set_page_config(layout="wide", page_title="Web UI", page_icon=":ghost:", initial_sidebar_state="expanded") | |
# Apply dark theme and maximize iframe | |
st.markdown(""" | |
<style> | |
#root > div:nth-child(1) > div > div > div > div > section > div {padding-top: 0rem;} | |
.reportview-container {background-color: #000000;} | |
.sidebar .sidebar-content {background-color: #262730;} | |
.Widget>label {color: white;} | |
.stRadio>div{color: white;} | |
.stCheckbox>div{color: white;} | |
.stSelectbox>div{color: white;} | |
.main .block-container {background-color: #000000; padding: 0rem;} | |
iframe {width: 100vw; height: 100vh; border: none;} | |
header {visibility: hidden;} | |
#MainMenu {visibility: hidden;} | |
footer {visibility: hidden;} | |
</style> | |
""", unsafe_allow_html=True) | |
# Sidebar menu | |
st.sidebar.title("๋ฉ๋ด") | |
menu = st.sidebar.radio("์ ํํ์ธ์:", ("A", "B")) | |
# Main content | |
if menu == "A": | |
components.iframe("https://seawolf2357-flxloraexp.hf.space", height=1000, scrolling=True) | |
elif menu == "B": | |
try: | |
components.iframe("http://hugpu.ai:7897", height=1000, scrolling=True) | |
except Exception as e: | |
st.error(f"B ๋ฉ๋ด ๋ก๋ฉ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}") | |
st.info("http://hugpu.ai:8000 ์ ์ ๊ทผํ ์ ์์ต๋๋ค. URL์ด ์ฌ๋ฐ๋ฅธ์ง, ๊ทธ๋ฆฌ๊ณ ๊ณต๊ฐ์ ์ผ๋ก ์ ๊ทผ ๊ฐ๋ฅํ์ง ํ์ธํด ์ฃผ์ธ์.") | |
# Make the layout responsive and ensure iframes are loaded correctly | |
st.markdown(""" | |
<script> | |
window.addEventListener('load', function() { | |
var iframes = document.getElementsByTagName('iframe'); | |
for (var i = 0; i < iframes.length; i++) { | |
iframes[i].style.height = window.innerHeight + 'px'; | |
iframes[i].style.width = '100%'; | |
} | |
}); | |
window.addEventListener('resize', function() { | |
var iframes = document.getElementsByTagName('iframe'); | |
for (var i = 0; i < iframes.length; i++) { | |
iframes[i].style.height = window.innerHeight + 'px'; | |
} | |
}); | |
</script> | |
""", unsafe_allow_html=True) |