Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -259,39 +259,8 @@ with gr.Blocks() as demo:
|
|
259 |
oha_output = gr.Textbox(label="OHA Output", value="", interactive=False)
|
260 |
save_button = gr.Button("Save to Supabase", elem_id="save_button", interactive=True)
|
261 |
|
262 |
-
def handle_transcription(audio, doctor_name, location):
|
263 |
-
context = transcribe_audio(audio)
|
264 |
-
if "Error" in context:
|
265 |
-
# Return error message for all fields
|
266 |
-
return [context] * len(textboxes_left + textboxes_right) + [context]
|
267 |
-
|
268 |
-
answers = handle_transcription(audio, doctor_name, location)
|
269 |
-
answers.update({
|
270 |
-
"Doctor’s Name": doctor_name,
|
271 |
-
"Location": location
|
272 |
-
})
|
273 |
-
|
274 |
-
# Return the answers in the order of textboxes and dropdowns
|
275 |
-
return [
|
276 |
-
answers.get("Age", ""),
|
277 |
-
answers.get("Gender", ""),
|
278 |
-
answers.get("Chief complaint", ""),
|
279 |
-
answers.get("Medical history", ""),
|
280 |
-
answers.get("Dental history", ""),
|
281 |
-
answers.get("Clinical Findings", ""),
|
282 |
-
answers.get("Referred to", ""),
|
283 |
-
answers.get("Treatment plan", ""),
|
284 |
-
answers.get("Calculus", ""),
|
285 |
-
answers.get("Stains", ""),
|
286 |
-
doctor_name,
|
287 |
-
location
|
288 |
-
]
|
289 |
-
|
290 |
-
def save_to_supabase(doctor_name, location, patient_name, age, gender, chief_complaint, medical_history, dental_history, clinical_findings, treatment_plan, referred_to, calculus, stains):
|
291 |
-
return save_answers(doctor_name, location, patient_name, age, gender, chief_complaint, medical_history, dental_history, clinical_findings, treatment_plan, referred_to, calculus, stains)
|
292 |
-
|
293 |
transcribe_button.click(fn=handle_transcription, inputs=[audio_input, doctor_name_display, location_display], outputs=textboxes_left + textboxes_right + [oha_output])
|
294 |
-
save_button.click(fn=
|
295 |
|
296 |
with gr.Tab("Download Data"):
|
297 |
download_button = gr.Button("Download CSV")
|
|
|
259 |
oha_output = gr.Textbox(label="OHA Output", value="", interactive=False)
|
260 |
save_button = gr.Button("Save to Supabase", elem_id="save_button", interactive=True)
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
transcribe_button.click(fn=handle_transcription, inputs=[audio_input, doctor_name_display, location_display], outputs=textboxes_left + textboxes_right + [oha_output])
|
263 |
+
save_button.click(fn=save_answers, inputs=[doctor_name_display, location_display, patient_name_input] + textboxes_left + textboxes_right, outputs=oha_output)
|
264 |
|
265 |
with gr.Tab("Download Data"):
|
266 |
download_button = gr.Button("Download CSV")
|