Tonic commited on
Commit
f207c28
·
unverified ·
1 Parent(s): a8bfb0b

remove js=True in all remaining functions

Browse files
Files changed (1) hide show
  1. callbackmanager.py +21 -32
callbackmanager.py CHANGED
@@ -907,15 +907,13 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
907
  extract_code_button.click(
908
  fn=process_redirected_url,
909
  inputs=redirected_url_input,
910
- outputs=[extracted_code_output, auth_result],
911
- js=True# Reusing auth_result for extraction status
912
  )
913
 
914
  auth_submit.click(
915
  fn=CALLBACK_MANAGER.set_auth_code,
916
  inputs=extracted_code_output, # Using extracted code as input for authentication
917
  outputs=auth_result,
918
- js=True
919
  )
920
 
921
  with gr.Tab("Patient Dashboard", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
@@ -977,36 +975,36 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
977
 
978
  with gr.Tab("Discharge Form", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
979
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Patient Details</h2>") # Neon Tab Header
980
- with gr.Row(js=True):
981
  first_name = gr.Textbox(label="First Name")
982
  last_name = gr.Textbox(label="Last Name")
983
  middle_initial = gr.Textbox(label="Middle Initial")
984
- with gr.Row(js=True):
985
  dob = gr.Textbox(label="Date of Birth")
986
  age = gr.Textbox(label="Age")
987
  sex = gr.Textbox(label="Sex")
988
  address = gr.Textbox(label="Address")
989
- with gr.Row(js=True):
990
  city = gr.Textbox(label="City")
991
  state = gr.Textbox(label="State")
992
  zip_code = gr.Textbox(label="Zip Code")
993
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Primary Healthcare Professional Details</h2>") # Neon Sub-header
994
- with gr.Row(js=True):
995
  doctor_first_name = gr.Textbox(label="Doctor's First Name")
996
  doctor_last_name = gr.Textbox(label="Doctor's Last Name")
997
  doctor_middle_initial = gr.Textbox(label="Doctor's Middle Initial")
998
  hospital_name = gr.Textbox(label="Hospital/Clinic Name")
999
  doctor_address = gr.Textbox(label="Address")
1000
- with gr.Row(js=True):
1001
  doctor_city = gr.Textbox(label="City")
1002
  doctor_state = gr.Textbox(label="State")
1003
  doctor_zip = gr.Textbox(label="Zip Code")
1004
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Admission and Discharge Details</h2>") # Neon Sub-header
1005
- with gr.Row(js=True):
1006
  admission_date = gr.Textbox(label="Date of Admission")
1007
  referral_source = gr.Textbox(label="Source of Referral")
1008
  admission_method = gr.Textbox(label="Method of Admission")
1009
- with gr.Row(js=True):
1010
  discharge_date = gr.Textbox(label="Date of Discharge")
1011
  discharge_reason = gr.Radio(
1012
  ["Treated", "Transferred", "Discharge Against Advice", "Patient Died"],
@@ -1019,12 +1017,12 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1019
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Medication Details</h2>") # Neon Sub-header
1020
  medications = gr.Textbox(label="Medication on Discharge")
1021
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Prepared By</h2>") # Neon Sub-header
1022
- with gr.Row(js=True):
1023
  preparer_name = gr.Textbox(label="Name")
1024
  preparer_job_title = gr.Textbox(label="Job Title")
1025
 
1026
  # Add buttons for both display form and generate PDF
1027
- with gr.Row(js=True):
1028
  submit_display = gr.Button("Display Form", elem_classes="cyberpunk-button") # Cyberpunk button style
1029
  submit_pdf = gr.Button("Generate PDF (No AI)", elem_classes="cyberpunk-button") # Renamed button to clarify no AI and styled
1030
 
@@ -1066,8 +1064,7 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1066
  preparer_name,
1067
  preparer_job_title,
1068
  ],
1069
- outputs=form_output,
1070
- js=True
1071
  )
1072
 
1073
  # Connect the generate PDF button (No AI version)
@@ -1104,13 +1101,12 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1104
  preparer_name,
1105
  preparer_job_title,
1106
  ],
1107
- outputs=pdf_output,
1108
- js=True
1109
  )
1110
 
1111
  with gr.Tab("Medical File Analysis", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
1112
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Analyze Medical Files with Discharge Guard AI</h2>") # Neon Tab Header
1113
- with gr.Column(js=True):
1114
  dicom_file = gr.File(
1115
  file_types=[".dcm"], label="Upload DICOM File (.dcm)"
1116
  )
@@ -1159,32 +1155,27 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1159
  analyze_dicom_button.click(
1160
  analyze_dicom_file_with_ai, # Call REAL AI function
1161
  inputs=dicom_file,
1162
- outputs=dicom_ai_output,
1163
- js=True
1164
  )
1165
  analyze_hl7_button.click(
1166
  analyze_hl7_file_with_ai, # Call REAL AI function
1167
  inputs=hl7_file,
1168
- outputs=hl7_ai_output,
1169
- js=True
1170
  )
1171
  analyze_xml_button.click(
1172
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1173
  inputs=xml_file,
1174
- outputs=xml_ai_output,
1175
- js=True
1176
  )
1177
  analyze_ccda_button.click(
1178
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1179
  inputs=ccda_file,
1180
- outputs=ccda_ai_output,
1181
- js=True
1182
  )
1183
  analyze_ccd_button.click( # Redundant button, but kept for UI if needed
1184
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1185
  inputs=ccd_file,
1186
- outputs=ccd_ai_output,
1187
- js=True
1188
  )
1189
  analyze_pdf_button.click(
1190
  analyze_pdf_file_with_ai, inputs=pdf_file, outputs=pdf_ai_output
@@ -1198,7 +1189,7 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1198
  ): # New Tab for One-Click Discharge Paper with AI, styled
1199
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>One-Click Medical Discharge Paper Generation with AI Content</h2>") # Neon Tab Header
1200
  one_click_ai_pdf_button = gr.Button(
1201
- "Generate Discharge Paper with AI (One-Click)", elem_classes="cyberpunk-button", js=True
1202
  ) # Updated button label and styled
1203
  one_click_ai_pdf_status = gr.Textbox(
1204
  label="Discharge Paper Generation Status (AI)"
@@ -1217,8 +1208,7 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1217
  patient_data_button.click(
1218
  fn=CALLBACK_MANAGER.get_patient_data,
1219
  inputs=None,
1220
- outputs=patient_data_output,
1221
- js=True
1222
  )
1223
 
1224
  # Connect refresh button to update dashboard
@@ -1230,8 +1220,7 @@ with gr.Blocks(theme=cyberpunk_theme) as demo: # Apply the theme here
1230
  meldrx_pdf_button.click(
1231
  fn=generate_pdf_from_meldrx,
1232
  inputs=patient_data_output,
1233
- outputs=[meldrx_pdf_download, meldrx_pdf_status],
1234
- js=True
1235
  )
1236
 
1237
  # Connect patient data updates to dashboard
 
907
  extract_code_button.click(
908
  fn=process_redirected_url,
909
  inputs=redirected_url_input,
910
+ outputs=[extracted_code_output, auth_result],# Reusing auth_result for extraction status
 
911
  )
912
 
913
  auth_submit.click(
914
  fn=CALLBACK_MANAGER.set_auth_code,
915
  inputs=extracted_code_output, # Using extracted code as input for authentication
916
  outputs=auth_result,
 
917
  )
918
 
919
  with gr.Tab("Patient Dashboard", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
 
975
 
976
  with gr.Tab("Discharge Form", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
977
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Patient Details</h2>") # Neon Tab Header
978
+ with gr.Row():
979
  first_name = gr.Textbox(label="First Name")
980
  last_name = gr.Textbox(label="Last Name")
981
  middle_initial = gr.Textbox(label="Middle Initial")
982
+ with gr.Row():
983
  dob = gr.Textbox(label="Date of Birth")
984
  age = gr.Textbox(label="Age")
985
  sex = gr.Textbox(label="Sex")
986
  address = gr.Textbox(label="Address")
987
+ with gr.Row():
988
  city = gr.Textbox(label="City")
989
  state = gr.Textbox(label="State")
990
  zip_code = gr.Textbox(label="Zip Code")
991
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Primary Healthcare Professional Details</h2>") # Neon Sub-header
992
+ with gr.Row():
993
  doctor_first_name = gr.Textbox(label="Doctor's First Name")
994
  doctor_last_name = gr.Textbox(label="Doctor's Last Name")
995
  doctor_middle_initial = gr.Textbox(label="Doctor's Middle Initial")
996
  hospital_name = gr.Textbox(label="Hospital/Clinic Name")
997
  doctor_address = gr.Textbox(label="Address")
998
+ with gr.Row():
999
  doctor_city = gr.Textbox(label="City")
1000
  doctor_state = gr.Textbox(label="State")
1001
  doctor_zip = gr.Textbox(label="Zip Code")
1002
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Admission and Discharge Details</h2>") # Neon Sub-header
1003
+ with gr.Row():
1004
  admission_date = gr.Textbox(label="Date of Admission")
1005
  referral_source = gr.Textbox(label="Source of Referral")
1006
  admission_method = gr.Textbox(label="Method of Admission")
1007
+ with gr.Row():
1008
  discharge_date = gr.Textbox(label="Date of Discharge")
1009
  discharge_reason = gr.Radio(
1010
  ["Treated", "Transferred", "Discharge Against Advice", "Patient Died"],
 
1017
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Medication Details</h2>") # Neon Sub-header
1018
  medications = gr.Textbox(label="Medication on Discharge")
1019
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Prepared By</h2>") # Neon Sub-header
1020
+ with gr.Row():
1021
  preparer_name = gr.Textbox(label="Name")
1022
  preparer_job_title = gr.Textbox(label="Job Title")
1023
 
1024
  # Add buttons for both display form and generate PDF
1025
+ with gr.Row():
1026
  submit_display = gr.Button("Display Form", elem_classes="cyberpunk-button") # Cyberpunk button style
1027
  submit_pdf = gr.Button("Generate PDF (No AI)", elem_classes="cyberpunk-button") # Renamed button to clarify no AI and styled
1028
 
 
1064
  preparer_name,
1065
  preparer_job_title,
1066
  ],
1067
+ outputs=form_output
 
1068
  )
1069
 
1070
  # Connect the generate PDF button (No AI version)
 
1101
  preparer_name,
1102
  preparer_job_title,
1103
  ],
1104
+ outputs=pdf_output
 
1105
  )
1106
 
1107
  with gr.Tab("Medical File Analysis", elem_classes="cyberpunk-tab"): # Optional: Class for tab styling
1108
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>Analyze Medical Files with Discharge Guard AI</h2>") # Neon Tab Header
1109
+ with gr.Column():
1110
  dicom_file = gr.File(
1111
  file_types=[".dcm"], label="Upload DICOM File (.dcm)"
1112
  )
 
1155
  analyze_dicom_button.click(
1156
  analyze_dicom_file_with_ai, # Call REAL AI function
1157
  inputs=dicom_file,
1158
+ outputs=dicom_ai_output
 
1159
  )
1160
  analyze_hl7_button.click(
1161
  analyze_hl7_file_with_ai, # Call REAL AI function
1162
  inputs=hl7_file,
1163
+ outputs=hl7_ai_output
 
1164
  )
1165
  analyze_xml_button.click(
1166
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1167
  inputs=xml_file,
1168
+ outputs=xml_ai_output
 
1169
  )
1170
  analyze_ccda_button.click(
1171
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1172
  inputs=ccda_file,
1173
+ outputs=ccda_ai_output
 
1174
  )
1175
  analyze_ccd_button.click( # Redundant button, but kept for UI if needed
1176
  analyze_cda_xml_file_with_ai, # Call REAL AI function
1177
  inputs=ccd_file,
1178
+ outputs=ccd_ai_output
 
1179
  )
1180
  analyze_pdf_button.click(
1181
  analyze_pdf_file_with_ai, inputs=pdf_file, outputs=pdf_ai_output
 
1189
  ): # New Tab for One-Click Discharge Paper with AI, styled
1190
  gr.Markdown("<h2 style='color:#00FFFF; text-shadow: 0 0 3px #00FFFF;'>One-Click Medical Discharge Paper Generation with AI Content</h2>") # Neon Tab Header
1191
  one_click_ai_pdf_button = gr.Button(
1192
+ "Generate Discharge Paper with AI (One-Click)", elem_classes="cyberpunk-button"
1193
  ) # Updated button label and styled
1194
  one_click_ai_pdf_status = gr.Textbox(
1195
  label="Discharge Paper Generation Status (AI)"
 
1208
  patient_data_button.click(
1209
  fn=CALLBACK_MANAGER.get_patient_data,
1210
  inputs=None,
1211
+ outputs=patient_data_output
 
1212
  )
1213
 
1214
  # Connect refresh button to update dashboard
 
1220
  meldrx_pdf_button.click(
1221
  fn=generate_pdf_from_meldrx,
1222
  inputs=patient_data_output,
1223
+ outputs=[meldrx_pdf_download, meldrx_pdf_status]
 
1224
  )
1225
 
1226
  # Connect patient data updates to dashboard