Danh Tran
Upload 15 files
fbabf14 verified
Raw
History Blame Contribute Delete
385 Bytes
import streamlit as st
import inspect
import textwrap
def show_code(demo):
"""Showing the code of the demo."""
show_code = st.sidebar.checkbox("Show code", True)
if show_code:
# Showing the code of the demo.
st.markdown("## Code")
sourcelines, _ = inspect.getsourcelines(demo)
st.code(textwrap.dedent("".join(sourcelines[1:])))