navhira commited on
Commit
9176e30
·
1 Parent(s): 883fdeb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -1,4 +1,16 @@
1
  import streamlit as st
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ animal = st.form('my_animal')
4
+
5
+ # This is writing directly to the main body. Since the form container is
6
+ # defined above, this will appear below everything written in the form.
7
+ sound = st.selectbox('Sounds like', ['meow','woof','squeak','tweet'])
8
+
9
+ # These methods called on the form container, so they appear inside the form.
10
+ submit = animal.form_submit_button(f'Say it with {sound}!')
11
+ sentence = animal.text_input('Your sentence:', 'Where\'s the tuna?')
12
+ say_it = sentence.rstrip('.,!?') + f', {sound}!'
13
+ if submit:
14
+ animal.subheader(say_it)
15
+ else:
16
+ animal.subheader(' ')