Mia2024 commited on
Commit
970dd77
·
verified ·
1 Parent(s): c9e23c5
Files changed (1) hide show
  1. app.py +34 -35
app.py CHANGED
@@ -13,41 +13,40 @@ def delete_callback():
13
  del st.session_state.profession
14
  del st.session_state.hobby
15
 
16
- with st.form("my_input"):
17
- st.write("Input")
18
- # product
19
- product=st.text_input("product", key="product")
20
-
21
- # gender
22
- gender=st.radio("gender", ["male", "female"], key="gender")
23
-
24
- # profession
25
- profession=st.text_input("profession", key="profession")
26
-
27
- # hobby
28
- hobby=st.text_input("hobby", key="hobby")
29
-
30
- # Every form must have a submit button.
31
- col1, col2=st.columns(2)
32
-
33
- # Place a button in each column
34
- with col1:
35
- submitted = st.form_submit_button(label='Submit', on_click=submit_callback)
36
-
37
- with col2:
38
- clear = st.form_submit_button(label='Clear', on_click=delete_callback)
39
-
40
-
41
-
42
- # with st.form("my_output"):
43
- # if submitted:
44
- # st.write("product", st.session_state.product)
45
- # st.write("gender", st.session_state.gender)
46
- # st.write("profession", st.session_state.profession)
47
- # st.write("hobby", st.session_state.hobby)
48
- # # Clear the user inputs
49
- # if clear:
50
- # st.experimental_rerun()
51
 
52
  # _LOREM_IPSUM = """
53
  # Lorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor
 
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
+ with btn2:
36
+ clear = st.form_submit_button(label='Clear', on_click=delete_callback)
37
+
38
+ with col2:
39
+ with st.form("my_output"):
40
+ st.write("product", st.session_state.product)
41
+ st.write("gender", st.session_state.gender)
42
+ st.write("profession", st.session_state.profession)
43
+ st.write("hobby", st.session_state.hobby)
44
+
45
+
46
+
47
+
48
+
49
+
 
50
 
51
  # _LOREM_IPSUM = """
52
  # Lorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor