Spaces:
Sleeping
Sleeping
pr3
#3
by Mia2024 - opened
app.py
CHANGED
|
@@ -1,13 +1,41 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
st.write(
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import time
|
| 3 |
|
| 4 |
+
with st.form("my_form"):
|
| 5 |
+
st.write("Input")
|
| 6 |
+
# product
|
| 7 |
+
product=st.text_input("product")
|
| 8 |
+
# gender
|
| 9 |
+
gender=st.radio("gender", ["male", "female"])
|
| 10 |
+
# profession
|
| 11 |
+
profession=st.text_input("profession")
|
| 12 |
+
# hobby
|
| 13 |
+
hobby=st.text_input("hobby")
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Every form must have a submit button.
|
| 18 |
+
submitted = st.form_submit_button("Submit")
|
| 19 |
+
if submitted:
|
| 20 |
+
st.write("product", product)
|
| 21 |
+
st.write("gender", gender)
|
| 22 |
+
st.write("profession", profession)
|
| 23 |
+
st.write("hobby", hobby)
|
| 24 |
+
|
| 25 |
+
_LOREM_IPSUM = """
|
| 26 |
+
Lorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor
|
| 27 |
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
| 28 |
+
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
| 29 |
+
"""
|
| 30 |
+
|
| 31 |
+
def stream_data():
|
| 32 |
+
for word in _LOREM_IPSUM.split(" "):
|
| 33 |
+
yield word + " "
|
| 34 |
+
time.sleep(0.02)
|
| 35 |
+
|
| 36 |
+
for word in _LOREM_IPSUM.split(" "):
|
| 37 |
+
yield word + " "
|
| 38 |
+
time.sleep(0.02)
|
| 39 |
+
|
| 40 |
+
if st.button("Stream data"):
|
| 41 |
+
st.write_stream(stream_data)
|