fcesc-code commited on
Commit
b4d525a
β€’
1 Parent(s): 5bd2b6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -4,12 +4,21 @@ import streamlit as st
4
  # st.Page(page, *, title='Rainyday', default='True')
5
  # pg = st.navigation([st.Page("app.py", title="Bedstories"), st.Page("pages/response.py", title="Bedstory")])
6
  # pg.run()
 
 
 
 
 
 
 
 
7
  st.title("πŸ§šβ€β™€οΈ Magic Story Buddy πŸ“š")
8
  st.markdown("Let's create a magical story just for you!")
9
 
10
  # User input
11
- child_name = st.text_input("What's your name, young storyteller?")
12
  st.write('Your name is ', child_name)
 
13
  story_theme = st.selectbox("What would you like your story to be about?",
14
  ["Space Adventure", "Magical Forest", "Underwater World", "Dinosaur Discovery"])
15
 
 
4
  # st.Page(page, *, title='Rainyday', default='True')
5
  # pg = st.navigation([st.Page("app.py", title="Bedstories"), st.Page("pages/response.py", title="Bedstory")])
6
  # pg.run()
7
+ def child_update(value):
8
+ key = 'name'
9
+ st.write('Value:' value)
10
+ if key not in st.session_state:
11
+ st.session_state[key] = value
12
+ else:
13
+ st.session_state[key] = value
14
+
15
  st.title("πŸ§šβ€β™€οΈ Magic Story Buddy πŸ“š")
16
  st.markdown("Let's create a magical story just for you!")
17
 
18
  # User input
19
+ child_name = st.text_input("What's your name, young storyteller?", on_change=state_update)
20
  st.write('Your name is ', child_name)
21
+ st.write('The state is ', st.session_state['name'])
22
  story_theme = st.selectbox("What would you like your story to be about?",
23
  ["Space Adventure", "Magical Forest", "Underwater World", "Dinosaur Discovery"])
24