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