Created
February 2, 2023 05:46
-
-
Save andfanilo/fbac9d974a882d764296bd48a18956a1 to your computer and use it in GitHub Desktop.
Streamlit Monkeypatching example (from https://www.youtube.com/watch?v=6f4yYwsqQD8)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
from streamlit.delta_generator import DeltaGenerator | |
from streamlit.proto.Markdown_pb2 import Markdown as MarkdownProto | |
from streamlit.string_util import clean_text | |
def markdown_but_yelling(body, unsafe_allow_html=False): | |
body = f"# {body.upper()}!!!!" | |
markdown_proto = MarkdownProto() | |
markdown_proto.body = clean_text(body) | |
markdown_proto.allow_html = unsafe_allow_html | |
return DeltaGenerator()._enqueue("markdown", markdown_proto) | |
st.markdown = markdown_but_yelling | |
st.title("Hello world") | |
st.markdown("Coucou") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Doing random tests:
the Yolo part is correctly updated 🤔