Spaces:
Runtime error
Runtime error
finally got the layout right
Browse files
app.py
CHANGED
@@ -28,8 +28,8 @@ def run_models(model_names, models, c):
|
|
28 |
return results
|
29 |
|
30 |
|
31 |
-
st.
|
32 |
-
st.
|
33 |
"""Medical education *requires* high-quality feedback, but evaluating feedback
|
34 |
is difficult and time-consuming. This tool uses NLP/ML to predict a validated
|
35 |
feedback quality metric known as the QuAL Score. *Try it for yourself!*
|
@@ -58,6 +58,7 @@ examples = load_pickle('test.pkl')
|
|
58 |
|
59 |
### Process input
|
60 |
ex = examples['comment'].sample(1).tolist()[0]
|
|
|
61 |
if 'comment' not in st.session_state:
|
62 |
st.session_state['comment'] = ex
|
63 |
with st.form('comment_form'):
|
@@ -77,13 +78,10 @@ with st.form('comment_form'):
|
|
77 |
|
78 |
results = run_models(models_to_load, models, st.session_state['comment'])
|
79 |
|
80 |
-
tab_titles = ['Overview', 'Q1 - Level of Detail', 'Q2 - Suggestion Given', 'Q3 - Suggestion Linked']
|
81 |
tabs = st.tabs(tab_titles)
|
82 |
|
83 |
-
|
84 |
with tabs[0]:
|
85 |
-
with st.expander('About the QuAL score?'):
|
86 |
-
st.markdown('**The best thing ever**!')
|
87 |
cmap = cm.get_cmap('RdYlGn')
|
88 |
color = cmap(results['qual']['label'] / 6.0)
|
89 |
color = f'rgba({int(color[0]*256)}, {int(color[1]*256)}, {int(color[2]*256)}, {int(color[3]*256)})'
|
@@ -98,39 +96,44 @@ with tabs[0]:
|
|
98 |
'bar': {'color': color, 'thickness': 1.0},
|
99 |
|
100 |
}
|
101 |
-
)
|
102 |
-
|
103 |
-
st.
|
104 |
-
|
105 |
-
|
106 |
-
cols[
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
with tabs[1]:
|
136 |
st.write('hello')
|
|
|
28 |
return results
|
29 |
|
30 |
|
31 |
+
st.header('How *great* is your feedback?')
|
32 |
+
st.caption(
|
33 |
"""Medical education *requires* high-quality feedback, but evaluating feedback
|
34 |
is difficult and time-consuming. This tool uses NLP/ML to predict a validated
|
35 |
feedback quality metric known as the QuAL Score. *Try it for yourself!*
|
|
|
58 |
|
59 |
### Process input
|
60 |
ex = examples['comment'].sample(1).tolist()[0]
|
61 |
+
ex = ex.strip().replace('_x000D_', '').replace('nan', 'blank')
|
62 |
if 'comment' not in st.session_state:
|
63 |
st.session_state['comment'] = ex
|
64 |
with st.form('comment_form'):
|
|
|
78 |
|
79 |
results = run_models(models_to_load, models, st.session_state['comment'])
|
80 |
|
81 |
+
tab_titles = ['Overview', 'Q1 - Level of Detail', 'Q2 - Suggestion Given', 'Q3 - Suggestion Linked', 'About']
|
82 |
tabs = st.tabs(tab_titles)
|
83 |
|
|
|
84 |
with tabs[0]:
|
|
|
|
|
85 |
cmap = cm.get_cmap('RdYlGn')
|
86 |
color = cmap(results['qual']['label'] / 6.0)
|
87 |
color = f'rgba({int(color[0]*256)}, {int(color[1]*256)}, {int(color[2]*256)}, {int(color[3]*256)})'
|
|
|
96 |
'bar': {'color': color, 'thickness': 1.0},
|
97 |
|
98 |
}
|
99 |
+
))#, layout=go.Layout(width=750, height=300))# layout={'paper_bgcolor': 'rgb(245,245,245)'})#,
|
100 |
+
|
101 |
+
cols = st.columns([7, 3])
|
102 |
+
with cols[0]:
|
103 |
+
st.plotly_chart(fig, use_container_width=True)
|
104 |
+
with cols[1]:
|
105 |
+
|
106 |
+
|
107 |
+
# cols = st.columns(3)
|
108 |
+
# cols[0].markdown('#### Level of Detail')
|
109 |
+
q1lab = results['q1']['label']
|
110 |
+
if q1lab == 0:
|
111 |
+
md_str = 'π₯ None'
|
112 |
+
elif q1lab == 1:
|
113 |
+
md_str = 'π Low'
|
114 |
+
elif q1lab == 2:
|
115 |
+
md_str = 'π Medium'
|
116 |
+
elif q1lab == 3:
|
117 |
+
md_str = 'π High'
|
118 |
+
# cols[0].markdown(md_str)
|
119 |
+
cols[1].metric('Level of Detail', md_str,
|
120 |
+
help='How specific was the evaluator in describing the behavior?')
|
121 |
+
|
122 |
+
q2lab = results['q2i']['label']
|
123 |
+
if q2lab == 0:
|
124 |
+
md_str = 'β
Yes'
|
125 |
+
else:
|
126 |
+
md_str = 'β No'
|
127 |
+
cols[1].metric('Suggestion Given', (md_str),
|
128 |
+
help='Did the evaluator give a suggestion for improvement?')
|
129 |
+
|
130 |
+
q3lab = results['q3i']['label']
|
131 |
+
if q3lab == 0:
|
132 |
+
md_str = 'β
Yes'
|
133 |
+
else:
|
134 |
+
md_str = 'β No'
|
135 |
+
cols[1].metric('Suggestion Linked', md_str,
|
136 |
+
help='Is the suggestion for improvement linked to the described behavior?')
|
137 |
|
138 |
with tabs[1]:
|
139 |
st.write('hello')
|