aftersix
commited on
Commit
·
48a4bef
1
Parent(s):
89315bc
updated with formatting and overall flushing out
Browse files
app.py
CHANGED
@@ -12,6 +12,15 @@ st.set_page_config(page_title='auditory skills resources', page_icon='icon-128x1
|
|
12 |
if 'one' not in st.session_state:
|
13 |
st.session_state['one'] = 'value'
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
#main page content
|
16 |
with st.sidebar:
|
17 |
st.title('auditory skills')
|
@@ -24,10 +33,6 @@ with st.sidebar:
|
|
24 |
|
25 |
st.write('Made with resources provided by the HATCH (Helping Adults Talk to Children) Lab. The HATCH lab is located at Idaho State University in Meridian, Idaho and seeks to ensure that adults have access to tools and resources to optimize the language of children through connection and engagement')
|
26 |
|
27 |
-
#for callback
|
28 |
-
def proc(key):
|
29 |
-
st.session_state['one'] = key
|
30 |
-
#st.write(st.session_state['one'])
|
31 |
|
32 |
def main():
|
33 |
#st.markdown('hello')
|
@@ -67,21 +72,43 @@ def main():
|
|
67 |
step_cols = st.columns([.5,.85,.85,.85,.85,.5])
|
68 |
step_cols[1].button('Does your child respond to a familiar voice?',on_click=set_form_step,args=['Jump',1])
|
69 |
step_cols[2].button('Does your child listen to somebody speaking?',on_click=set_form_step,args=['Jump',2])
|
70 |
-
step_cols[3].button('
|
71 |
-
step_cols[4].button('
|
72 |
|
73 |
### Replace Wizard Form Body with this ###
|
74 |
def wizard_form_body():
|
75 |
if st.session_state['current_step'] == 1:
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
|
87 |
def wizard_form_footer():
|
@@ -112,15 +139,17 @@ def main():
|
|
112 |
|
113 |
render_wizard_view()
|
114 |
st.subheader('Your resources')
|
115 |
-
st.markdown('
|
116 |
-
st.markdown(st.session_state['
|
|
|
|
|
117 |
#sequence = "My kid will look at me when the tv is on but I'm in the other room"
|
118 |
#sequence_labels=["Detection", "discrimination", "Identification", "Classification"]
|
119 |
|
120 |
#output = classifier(sequence, sequence_labels)
|
121 |
#st.markdown(output)
|
122 |
with st.form("get-results"):
|
123 |
-
st.write("get results form")
|
124 |
submitted = st.form_submit_button("Get Results")
|
125 |
if submitted:
|
126 |
#load everything
|
@@ -129,10 +158,15 @@ def main():
|
|
129 |
#define classifier for zero shot classification
|
130 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
131 |
#define sequence
|
132 |
-
sequence_labels=["Detection", "
|
133 |
sequence = st.session_state['one']
|
134 |
output = classifier(sequence, sequence_labels)
|
135 |
-
st.markdown(output)
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
|
138 |
|
|
|
12 |
if 'one' not in st.session_state:
|
13 |
st.session_state['one'] = 'value'
|
14 |
|
15 |
+
if 'two' not in st.session_state:
|
16 |
+
st.session_state['two'] = 'value'
|
17 |
+
|
18 |
+
if 'three' not in st.session_state:
|
19 |
+
st.session_state['three'] = 'value'
|
20 |
+
|
21 |
+
if 'four' not in st.session_state:
|
22 |
+
st.session_state['four'] = 'value'
|
23 |
+
|
24 |
#main page content
|
25 |
with st.sidebar:
|
26 |
st.title('auditory skills')
|
|
|
33 |
|
34 |
st.write('Made with resources provided by the HATCH (Helping Adults Talk to Children) Lab. The HATCH lab is located at Idaho State University in Meridian, Idaho and seeks to ensure that adults have access to tools and resources to optimize the language of children through connection and engagement')
|
35 |
|
|
|
|
|
|
|
|
|
36 |
|
37 |
def main():
|
38 |
#st.markdown('hello')
|
|
|
72 |
step_cols = st.columns([.5,.85,.85,.85,.85,.5])
|
73 |
step_cols[1].button('Does your child respond to a familiar voice?',on_click=set_form_step,args=['Jump',1])
|
74 |
step_cols[2].button('Does your child listen to somebody speaking?',on_click=set_form_step,args=['Jump',2])
|
75 |
+
step_cols[3].button('Is your child interested in toys producing sounds or music?',on_click=set_form_step,args=['Jump',3])
|
76 |
+
step_cols[4].button('Does your child look for a speaker they cannot see?',on_click=set_form_step,args=['Jump',4])
|
77 |
|
78 |
### Replace Wizard Form Body with this ###
|
79 |
def wizard_form_body():
|
80 |
if st.session_state['current_step'] == 1:
|
81 |
+
form1 = st.form("question-1")
|
82 |
+
form1.write("Describe how your child reacts when a familiar voice is presented. Responses can be anything such as looking at the person, moving, a facial expression (e.g., smile), or a sound they make.")
|
83 |
+
textone = form1.text_input(" ")
|
84 |
+
submitted1 = form1.form_submit_button("Submit")
|
85 |
+
if submitted1:
|
86 |
+
st.session_state['one'] = textone
|
87 |
+
|
88 |
+
if st.session_state['current_step'] == 2:
|
89 |
+
form2 = st.form("question-2")
|
90 |
+
form2.write("Describe how your child reacts when someone is talking to them and responds with actions (e.g., looking at the person speaking, smiling) and vocalizations (e.g., laughing, babbling back and forth with speaker).")
|
91 |
+
texttwo = form2.text_input(" ")
|
92 |
+
submitted2 = form2.form_submit_button("Submit")
|
93 |
+
if submitted2:
|
94 |
+
st.session_state['two'] = texttwo
|
95 |
+
|
96 |
+
if st.session_state['current_step'] == 3:
|
97 |
+
form3 = st.form("question-3")
|
98 |
+
form3.write("Describe what happens when your child plays with or notices toys that are musical or have sound qualities. Your child may pick up the toy, move it, look at it, and/or mouth it.")
|
99 |
+
textthree = form3.text_input(" ")
|
100 |
+
submitted3 = form3.form_submit_button("Submit")
|
101 |
+
if submitted3:
|
102 |
+
st.session_state['three'] = textthree
|
103 |
+
|
104 |
+
if st.session_state['current_step'] == 4:
|
105 |
+
form4 = st.form("question-4")
|
106 |
+
form4.write("Describe what would happen if, while interacting with your child, another person begins talking behind you. Would your child stop talking? Turn and look? Search for the sound? Or perhaps vocalize?")
|
107 |
+
textfour = form4.text_input(" ")
|
108 |
+
submitted4 = form4.form_submit_button("Submit")
|
109 |
+
if submitted4:
|
110 |
+
st.session_state['four'] = textfour
|
111 |
+
|
112 |
|
113 |
|
114 |
def wizard_form_footer():
|
|
|
139 |
|
140 |
render_wizard_view()
|
141 |
st.subheader('Your resources')
|
142 |
+
#st.markdown(st.session_state['one'])
|
143 |
+
#st.markdown(st.session_state['two'])
|
144 |
+
#st.markdown(st.session_state['three'])
|
145 |
+
#st.markdown(st.session_state['four'])
|
146 |
#sequence = "My kid will look at me when the tv is on but I'm in the other room"
|
147 |
#sequence_labels=["Detection", "discrimination", "Identification", "Classification"]
|
148 |
|
149 |
#output = classifier(sequence, sequence_labels)
|
150 |
#st.markdown(output)
|
151 |
with st.form("get-results"):
|
152 |
+
#st.write("get results form")
|
153 |
submitted = st.form_submit_button("Get Results")
|
154 |
if submitted:
|
155 |
#load everything
|
|
|
158 |
#define classifier for zero shot classification
|
159 |
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
160 |
#define sequence
|
161 |
+
sequence_labels=["Detection", "Discrimination", "Identification", "Classification"]
|
162 |
sequence = st.session_state['one']
|
163 |
output = classifier(sequence, sequence_labels)
|
164 |
+
#st.markdown(output)
|
165 |
+
df = pd.DataFrame(output)
|
166 |
+
#st.markdown(df)
|
167 |
+
#st.markdown("For your response: " + str(df.at[0,'sequence']))
|
168 |
+
st.markdown("Your responses indicate your child is at the " + str(df.at[0,'labels']) + " " + str(df.at[0,'scores']) + " step of auditory processing")
|
169 |
+
st.markdown("Here is a link to the " + str(df.at[0,'labels']) + " resource.")
|
170 |
|
171 |
|
172 |
|