streamlit-extras
streamlit-extras copied to clipboard
Add https://github.com/arnaudmiribel/streamlit-to-stlite
Whenever you feel like it @blackary!
Think we're in a good-enough state for this one @blackary? Pretty sweet one tbh. Would probably only scope the .html downloader button presumably
Tangentially related, but @LukasMasuch came up with a fun way to embed... stlite within Streamlit. It is useful if you want to have a safe python kernel to eval from (since this runs on the client side, no security risk).
from streamlit.components.v1 import html
html(
"""
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>stlite app</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.css"
/>
</head>
<body>
<div id="root"></div>
<script src="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.js"></script>
<script>
if (window.location.search !== "?embed=true") {
window.location.search = "?embed=true";
}
stlite.mount(
`
import streamlit as st
st.markdown('<style>[data-baseweb~="modal"]{visibility: hidden;}</style>', unsafe_allow_html=True,)
name = st.text_input('Your name')
st.write("Hello,", name or "world")
`,
document.getElementById("root")
);
</script>
</body>
</html>
"""
)