Mia2024 commited on
Commit
7c39d11
·
verified ·
1 Parent(s): 3955dc3
Files changed (1) hide show
  1. app.py +29 -27
app.py CHANGED
@@ -12,41 +12,43 @@ def delete_callback():
12
  del st.session_state.gender
13
  del st.session_state.profession
14
  del st.session_state.hobby
 
15
 
16
  # # Create two columns
17
  # col1, col2 = st.columns(2)
18
 
19
  # # Place a form in each column
20
  # with col1:
21
- with st.form("my_input"):
22
- st.write("Input")
23
- # product
24
- product=st.text_input("product", key="product")
25
- # gender
26
- gender=st.radio("gender", ["male", "female"], key="gender")
27
- # profession
28
- profession=st.text_input("profession", key="profession")
29
- # hobby
30
- hobby=st.text_input("hobby", key="hobby")
31
- # Every form must have a submit button.
32
- btn1, btn2=st.columns(2)
33
- with btn1:
34
- # submitted = st.form_submit_button(label='Submit', on_click=submit_callback)
35
- submitted = st.form_submit_button(label='Submit')
36
- with btn2:
37
- clear = st.form_submit_button(label='Clear', on_click=delete_callback)
38
 
39
  # with col2:
40
- _LOREM_IPSUM = "product" + st.session_state.product + "\n"
41
- + "gender" + st.session_state.gender + "\n"
42
- + "profession" + st.session_state.profession + "\n"
43
- + "hobby" + st.session_state.hobby +"\n"
44
-
45
- def stream_data():
46
- for word in _LOREM_IPSUM.split(" "):
47
- yield word + " "
48
- time.sleep(0.02)
49
-
 
50
  st.write_stream(stream_data)
51
 
52
 
 
12
  del st.session_state.gender
13
  del st.session_state.profession
14
  del st.session_state.hobby
15
+ st.experimental_rerun()
16
 
17
  # # Create two columns
18
  # col1, col2 = st.columns(2)
19
 
20
  # # Place a form in each column
21
  # with col1:
22
+ with st.form("my_input"):
23
+ st.write("Input")
24
+ # product
25
+ product=st.text_input("product", key="product")
26
+ # gender
27
+ gender=st.radio("gender", ["male", "female"], key="gender")
28
+ # profession
29
+ profession=st.text_input("profession", key="profession")
30
+ # hobby
31
+ hobby=st.text_input("hobby", key="hobby")
32
+ # Every form must have a submit button.
33
+ btn1, btn2=st.columns(2)
34
+ with btn1:
35
+ # submitted = st.form_submit_button(label='Submit', on_click=submit_callback)
36
+ submitted = st.form_submit_button(label='Submit')
37
+ with btn2:
38
+ clear = st.form_submit_button(label='Clear', on_click=delete_callback)
39
 
40
  # with col2:
41
+ _LOREM_IPSUM = "product" + st.session_state.product + "\n"
42
+ + "gender" + st.session_state.gender + "\n"
43
+ + "profession" + st.session_state.profession + "\n"
44
+ + "hobby" + st.session_state.hobby +"\n"
45
+
46
+ def stream_data():
47
+ for word in _LOREM_IPSUM.split(" "):
48
+ yield word + " "
49
+ time.sleep(0.02)
50
+
51
+ if st.button("Stream data"):
52
  st.write_stream(stream_data)
53
 
54