Spaces:
Sleeping
Sleeping
File size: 374 Bytes
8337efe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import inspect
import textwrap
import streamlit as st
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:]))) |