show source code in lessions page
This commit is contained in:
@@ -38,3 +38,24 @@ def pythonx_lesson2():
|
||||
ax.imshow(wordcloud, interpolation='bilinear')
|
||||
plt.axis("off")
|
||||
st.pyplot(fig)
|
||||
|
||||
|
||||
|
||||
source_code = """
|
||||
import streamlit as st
|
||||
from wordcloud import WordCloud
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
text = st.text_area("Please input text to analyze")
|
||||
|
||||
if st.button("Analyze"):
|
||||
# Create a WordCloud object
|
||||
wordcloud = WordCloud(width=800, height=400, background_color='white').generate(text)
|
||||
fig, ax = plt.subplots()
|
||||
ax.imshow(wordcloud, interpolation='bilinear')
|
||||
plt.axis("off")
|
||||
st.pyplot(fig)
|
||||
"""
|
||||
st.divider()
|
||||
st.subheader("**Source Code of the Sample App.**")
|
||||
st.code(source_code, line_numbers=True)
|
||||
Reference in New Issue
Block a user