Spaces:
Sleeping
Sleeping
Commit
•
45fb2e5
1
Parent(s):
23749ca
Added space for Ravi's feedback
Browse files
app.py
CHANGED
@@ -12,46 +12,61 @@ txt1 = gr.Textbox(label='1st CHEW APSO Note', lines=16, interactive=False)
|
|
12 |
txt2 = gr.Textbox(label='GPT-4\'s Response', lines=16, interactive=False)
|
13 |
txt3 = gr.Textbox(label='2nd CHEW APSO Note', lines=16, interactive=False)
|
14 |
txt4 = gr.Textbox(label='Medical Officer\'s APSO Note', lines=16, interactive=False)
|
|
|
|
|
|
|
15 |
submit = gr.Button("Submit", variant='primary')
|
16 |
ddown = gr.Dropdown(assessments, label="Assessment", info="Select an assessment by clicking its ID", value=None, interactive=True)
|
17 |
|
18 |
def update_text(d):
|
19 |
-
out = ['']*
|
20 |
if d != None:
|
21 |
row_num = (df.assessment_id.values == d).argmax()
|
22 |
out[0] = df['soap_note'][row_num]
|
23 |
out[1] = df['ai_note'][row_num]
|
24 |
out[2] = df['soap_note'][row_num+1]
|
25 |
out[3] = df['soap_note'][row_num+2]
|
|
|
|
|
|
|
26 |
return out
|
27 |
|
28 |
def update_choices(files):
|
29 |
global df
|
30 |
assessments = []
|
31 |
for f_o in files:
|
|
|
32 |
df = pd.read_excel(f_o.name)
|
33 |
tmp = set(df['assessment_id'].tolist())
|
34 |
for x in tmp:
|
35 |
if not (x in assessments):
|
36 |
assessments.append(x)
|
|
|
37 |
return gr.update(choices=[c for c in assessments], value=None)
|
38 |
|
39 |
with gr.Blocks() as iface:
|
40 |
with gr.Row():
|
41 |
-
with gr.Column(scale=1):
|
42 |
-
txt2.render()
|
43 |
with gr.Column(scale=1):
|
44 |
txt1.render()
|
|
|
|
|
45 |
with gr.Column(scale=1):
|
46 |
txt3.render()
|
47 |
with gr.Column(scale=1):
|
48 |
txt4.render()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
with gr.Row():
|
50 |
with gr.Column(scale=1):
|
51 |
file_output = gr.File(file_count='multiple')
|
52 |
file_output.change(update_choices, inputs=[file_output], outputs=[ddown])
|
53 |
with gr.Column(scale=1):
|
54 |
ddown.render()
|
55 |
-
ddown.change(update_text, inputs=[ddown], outputs=[txt1, txt2, txt3, txt4])
|
56 |
|
57 |
iface.launch(debug=True)
|
|
|
12 |
txt2 = gr.Textbox(label='GPT-4\'s Response', lines=16, interactive=False)
|
13 |
txt3 = gr.Textbox(label='2nd CHEW APSO Note', lines=16, interactive=False)
|
14 |
txt4 = gr.Textbox(label='Medical Officer\'s APSO Note', lines=16, interactive=False)
|
15 |
+
txt5 = gr.Textbox(label='Ravi 4-word', lines=16, interactive=False)
|
16 |
+
txt6 = gr.Textbox(label='Ravi Feedback 1', lines=16, interactive=False)
|
17 |
+
txt7 = gr.Textbox(label='Ravi Feedback 2', lines=16, interactive=False)
|
18 |
submit = gr.Button("Submit", variant='primary')
|
19 |
ddown = gr.Dropdown(assessments, label="Assessment", info="Select an assessment by clicking its ID", value=None, interactive=True)
|
20 |
|
21 |
def update_text(d):
|
22 |
+
out = ['']*7
|
23 |
if d != None:
|
24 |
row_num = (df.assessment_id.values == d).argmax()
|
25 |
out[0] = df['soap_note'][row_num]
|
26 |
out[1] = df['ai_note'][row_num]
|
27 |
out[2] = df['soap_note'][row_num+1]
|
28 |
out[3] = df['soap_note'][row_num+2]
|
29 |
+
out[4] = df['4 word Ravi takeaway'][row_num]
|
30 |
+
out[5] = df['Ravi feedback to CHEW unassisted note'][row_num]
|
31 |
+
out[6] = df['Ravi feedback to GPT4 note'][row_num]
|
32 |
return out
|
33 |
|
34 |
def update_choices(files):
|
35 |
global df
|
36 |
assessments = []
|
37 |
for f_o in files:
|
38 |
+
print(f_o)
|
39 |
df = pd.read_excel(f_o.name)
|
40 |
tmp = set(df['assessment_id'].tolist())
|
41 |
for x in tmp:
|
42 |
if not (x in assessments):
|
43 |
assessments.append(x)
|
44 |
+
print(assessments)
|
45 |
return gr.update(choices=[c for c in assessments], value=None)
|
46 |
|
47 |
with gr.Blocks() as iface:
|
48 |
with gr.Row():
|
|
|
|
|
49 |
with gr.Column(scale=1):
|
50 |
txt1.render()
|
51 |
+
with gr.Column(scale=1):
|
52 |
+
txt2.render()
|
53 |
with gr.Column(scale=1):
|
54 |
txt3.render()
|
55 |
with gr.Column(scale=1):
|
56 |
txt4.render()
|
57 |
+
with gr.Row():
|
58 |
+
with gr.Column(scale=1):
|
59 |
+
txt5.render()
|
60 |
+
with gr.Column(scale=1):
|
61 |
+
txt6.render()
|
62 |
+
with gr.Column(scale=1):
|
63 |
+
txt7.render()
|
64 |
with gr.Row():
|
65 |
with gr.Column(scale=1):
|
66 |
file_output = gr.File(file_count='multiple')
|
67 |
file_output.change(update_choices, inputs=[file_output], outputs=[ddown])
|
68 |
with gr.Column(scale=1):
|
69 |
ddown.render()
|
70 |
+
ddown.change(update_text, inputs=[ddown], outputs=[txt1, txt2, txt3, txt4, txt5, txt6, txt7])
|
71 |
|
72 |
iface.launch(debug=True)
|