Spaces:
Sleeping
Sleeping
adding properly named app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
st.markdown('# Streamlit is soo easy.')
|
| 4 |
+
|
| 5 |
+
st.markdown('### Cheat Sheet Stuff')
|
| 6 |
+
text_dropdown = st.expander("View Text Examples", icon=":material/info:")
|
| 7 |
+
print(text_dropdown)
|
| 8 |
+
with text_dropdown:
|
| 9 |
+
st.write("Inside the expander.")
|
| 10 |
+
st.text("Fixed width text")
|
| 11 |
+
st.markdown("_Markdown_") # see *
|
| 12 |
+
st.latex(r""" e^{i\pi} + 1 = 0 """)
|
| 13 |
+
st.title("My title")
|
| 14 |
+
st.header("My header")
|
| 15 |
+
st.subheader("My sub")
|
| 16 |
+
st.code("for i in range(8): foo()")
|
| 17 |
+
st.html("<p>Hi!</p>")
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
image_dropdown = st.expander("View Image Examples", icon=":material/image:")
|
| 21 |
+
with image_dropdown:
|
| 22 |
+
image_url = 'https://whalebonemag.com/wp-content/uploads/2015/04/IMG_3133-1050x788.jpg'
|
| 23 |
+
caption = 'Displaying in image that is online. (Thanks to whalebone magazine.)'
|
| 24 |
+
st.image(image_url, caption)
|
| 25 |
+
|
| 26 |
+
# callbacks_dropdown = st.expander("View Callbacks Examples", icon="📲")
|
| 27 |
+
callbacks_dropdown = st.expander("View Callbacks Examples")
|
| 28 |
+
with callbacks_dropdown:
|
| 29 |
+
st.markdown('# Callbacks')
|
| 30 |
+
|
| 31 |
+
st.markdown('---')
|
| 32 |
+
button_result = st.button("Click me")
|
| 33 |
+
if button_result:
|
| 34 |
+
st.write('Your button_result variable = ', button_result)
|
| 35 |
+
|
| 36 |
+
# # st.download_button("Download file", data)
|
| 37 |
+
st.markdown('---')
|
| 38 |
+
feedback_result = st.feedback("thumbs")
|
| 39 |
+
if feedback_result:
|
| 40 |
+
st.write("feedback_result", feedback_result)
|
| 41 |
+
|
| 42 |
+
st.markdown('---')
|
| 43 |
+
st.link_button("Go to a website", 'https://www.reddit.com/r/all/')
|
| 44 |
+
|
| 45 |
+
st.markdown('---')
|
| 46 |
+
checkbox_result = st.checkbox("I agree")
|
| 47 |
+
if checkbox_result:
|
| 48 |
+
st.write('Checkbox Result', checkbox_result)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
st.markdown('---')
|
| 52 |
+
toggle_result = st.toggle("Enable")
|
| 53 |
+
if toggle_result:
|
| 54 |
+
st.write("toggle_result", toggle_result)
|
| 55 |
+
|
| 56 |
+
st.markdown('---')
|
| 57 |
+
radio_result = st.radio("Pick one", ["cats", "dogs"])
|
| 58 |
+
if radio_result:
|
| 59 |
+
st.write("radio_result", radio_result)
|
| 60 |
+
|
| 61 |
+
st.markdown('---')
|
| 62 |
+
selectbox = st.selectbox("Pick one", ["cats", "dogs"])
|
| 63 |
+
if selectbox:
|
| 64 |
+
st.write(selectbox)
|
| 65 |
+
|
| 66 |
+
st.markdown('---')
|
| 67 |
+
multiselect = st.multiselect("Buy", ["milk", "apples", "potatoes"])
|
| 68 |
+
if multiselect:
|
| 69 |
+
st.write(multiselect)
|
| 70 |
+
|
| 71 |
+
st.markdown('---')
|
| 72 |
+
slider = st.slider("Pick a number", 0, 100)
|
| 73 |
+
if slider:
|
| 74 |
+
st.write(slider)
|
| 75 |
+
|
| 76 |
+
st.markdown('---')
|
| 77 |
+
user_text_input = st.text_input("Type your input here")
|
| 78 |
+
if user_text_input:
|
| 79 |
+
st.write("Your user text input:", user_text_input)
|
| 80 |
+
|
| 81 |
+
st.markdown('---')
|
| 82 |
+
date_input = st.date_input("Your birthday")
|
| 83 |
+
if date_input:
|
| 84 |
+
st.write("date_input", date_input)
|