NikilDGr8 commited on
Commit
a81278a
·
verified ·
1 Parent(s): b6b8268

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -228,24 +228,23 @@ with gr.Blocks() as demo:
228
  answers = fill_textboxes(context)
229
  answers_list = [doctor_name, location] + [""] # Initial patient name field empty
230
  answers_list += [answers.get(field, "") for field in form_fields[:-1]] # Exclude "Referred to"
231
- answers_list.append("") # Placeholder for "Referred to"
232
 
233
  return answers_list
234
 
235
  transcribe_button.click(fn=update_textboxes, inputs=[audio_input, doctor_name_input, location_input], outputs=[doctor_name_display, location_display] + [patient_name_input] + textboxes_left + textboxes_right + [dropdown_referred])
236
- submit_button = gr.Button("Submit", elem_id="submit_button")
237
- result_output = gr.HTML(label="Submission Result")
238
-
239
- def handle_submission(patient_name, age, gender, chief_complaint, dental_history, clinical_findings, treatment_plan, referred_to):
240
- return save_answers(doctor_name_input.value, location_input.value, patient_name, age, gender, chief_complaint, "none", dental_history, clinical_findings, treatment_plan, referred_to)
241
-
242
- submit_button.click(fn=handle_submission, inputs=[patient_name_input] + textboxes_left + textboxes_right + [dropdown_referred], outputs=result_output)
243
 
244
- # Third tab for Download
245
- with gr.Tab("Download CSV"):
 
246
  download_button = gr.Button("Download Data as CSV")
 
247
  download_output = gr.File(label="Download CSV")
248
 
 
 
 
 
249
  download_button.click(fn=gradio_download, outputs=download_output)
250
 
251
  # Run the Gradio app
 
228
  answers = fill_textboxes(context)
229
  answers_list = [doctor_name, location] + [""] # Initial patient name field empty
230
  answers_list += [answers.get(field, "") for field in form_fields[:-1]] # Exclude "Referred to"
231
+ answers_list.append(answers.get("Referred to", "")) # Ensure "Referred to" is included
232
 
233
  return answers_list
234
 
235
  transcribe_button.click(fn=update_textboxes, inputs=[audio_input, doctor_name_input, location_input], outputs=[doctor_name_display, location_display] + [patient_name_input] + textboxes_left + textboxes_right + [dropdown_referred])
 
 
 
 
 
 
 
236
 
237
+ # Third tab for Save and Download
238
+ with gr.Tab("Save and Download"):
239
+ save_button = gr.Button("Save Form")
240
  download_button = gr.Button("Download Data as CSV")
241
+ save_output = gr.HTML(label="Save Status")
242
  download_output = gr.File(label="Download CSV")
243
 
244
+ def handle_submission(patient_name, age, gender, chief_complaint, dental_history, clinical_findings, treatment_plan, referred_to):
245
+ return save_answers(doctor_name_input.value, location_input.value, patient_name, age, gender, chief_complaint, "none", dental_history, clinical_findings, treatment_plan, referred_to)
246
+
247
+ save_button.click(fn=handle_submission, inputs=[patient_name_input] + textboxes_left + textboxes_right + [dropdown_referred], outputs=save_output)
248
  download_button.click(fn=gradio_download, outputs=download_output)
249
 
250
  # Run the Gradio app