Py.Cafe

maartenbreddels/

generate-pycafe-link-code-and-requirements

Snippet Sharing Tool Demo (with requirements)

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
import streamlit as st
from urllib.parse import quote

code = quote("""import streamlit as st

if st.button("PyCafe is great"):
    st.balloons()
""")

url = f"https://py.cafe/snippet/streamlit/v1#code={code}"

st.link_button("Open snippet in new tab", url)
st.markdown(f"```\n{url}\n```")