Py.Cafe

maartenbreddels/

generate-pycafe-link-code-only

Snippet Sharing Tool Demo8

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

# Note: you can also have a link to code
# code = quote("https://raw.githubusercontent.com/streamlit/streamlit/refs/heads/develop/lib/tests/streamlit/test_data/widgets_script.py")
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", url)
st.text(url)