Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -232,48 +232,31 @@ with gr.Blocks() as demo:
|
|
232 |
dropdown_referred = gr.Dropdown(choices=["NONE", "ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], value="NONE", label="Referred to", interactive=True)
|
233 |
dropdown_Calculus = gr.Dropdown(choices=["+", "++", "+++"], label="Calculus", interactive=True)
|
234 |
dropdown_stains = gr.Dropdown(choices=["+", "++", "+++"], label="Stains", interactive=True)
|
235 |
-
dropdown_treatment_plan = gr.Dropdown(choices=["Scaling", "Filling", "Pulp therapy", "Extraction", "Medication"], label="Treatment plan", interactive=True)
|
236 |
-
|
237 |
-
def enable_transcribe_button(audio_path: str):
|
238 |
-
return gr.update(interactive=True)
|
239 |
-
|
240 |
-
audio_input.change(fn=enable_transcribe_button, inputs=audio_input, outputs=transcribe_button)
|
241 |
-
|
242 |
-
def update_textboxes(audio: str, doctor_name: str, location: str):
|
243 |
-
context = transcribe_audio(audio)
|
244 |
-
|
245 |
-
if "Error" in context:
|
246 |
-
return [context] * len(oral_health_assessment_form) # Adjust for the number of fields
|
247 |
-
|
248 |
-
answers = fill_textboxes(context)
|
249 |
-
answers_list = [doctor_name, location, ""] # Initial patient name field empty
|
250 |
-
answers_list += [answers.get(field, "") for field in form_fields]
|
251 |
-
return answers_list
|
252 |
|
253 |
transcribe_button.click(
|
254 |
-
fn=
|
255 |
inputs=[audio_input, doctor_name_input, location_input],
|
256 |
outputs=[doctor_name_display, location_display, patient_name_input] + textboxes_left + textboxes_right + [clinical_findings_input, dropdown_referred, dropdown_treatment_plan, dropdown_Calculus, dropdown_stains]
|
257 |
)
|
258 |
|
259 |
-
save_button = gr.Button("Save
|
260 |
-
save_output = gr.HTML(
|
261 |
-
|
262 |
-
def handle_submission(doctor_name: str, location: str, patient_name: str, age: str, gender: str, chief_complaint: str, medical_history: str, dental_history: str, clinical_findings: str, treatment_plan: str, referred_to: str, Calculus: str, stains: str):
|
263 |
-
return save_answers(doctor_name, location, patient_name, age, gender, chief_complaint, medical_history, dental_history, clinical_findings, treatment_plan, referred_to, Calculus, stains)
|
264 |
|
265 |
save_button.click(
|
266 |
-
fn=
|
267 |
-
inputs=[doctor_name_display, location_display, patient_name_input] + textboxes_left + textboxes_right + [clinical_findings_input, dropdown_referred, dropdown_treatment_plan, dropdown_Calculus, dropdown_stains],
|
268 |
outputs=save_output
|
269 |
)
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
download_button = gr.Button("Download Data as CSV")
|
274 |
-
download_output = gr.File(label="Download CSV")
|
275 |
|
276 |
-
download_button.click(
|
|
|
|
|
|
|
|
|
277 |
|
278 |
-
#
|
279 |
demo.launch()
|
|
|
232 |
dropdown_referred = gr.Dropdown(choices=["NONE", "ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], value="NONE", label="Referred to", interactive=True)
|
233 |
dropdown_Calculus = gr.Dropdown(choices=["+", "++", "+++"], label="Calculus", interactive=True)
|
234 |
dropdown_stains = gr.Dropdown(choices=["+", "++", "+++"], label="Stains", interactive=True)
|
235 |
+
dropdown_treatment_plan = gr.Dropdown(choices=["Scaling", "Filling", "Pulp therapy/RCT", "Extraction", "Medication", "Referral"], label="Treatment plan", interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
|
237 |
transcribe_button.click(
|
238 |
+
fn=main,
|
239 |
inputs=[audio_input, doctor_name_input, location_input],
|
240 |
outputs=[doctor_name_display, location_display, patient_name_input] + textboxes_left + textboxes_right + [clinical_findings_input, dropdown_referred, dropdown_treatment_plan, dropdown_Calculus, dropdown_stains]
|
241 |
)
|
242 |
|
243 |
+
save_button = gr.Button("Save")
|
244 |
+
save_output = gr.HTML()
|
|
|
|
|
|
|
245 |
|
246 |
save_button.click(
|
247 |
+
fn=save_answers,
|
248 |
+
inputs=[doctor_name_display, location_display, patient_name_input] + textboxes_left + textboxes_right + [clinical_findings_input, dropdown_referred, dropdown_treatment_plan, dropdown_Calculus, dropdown_stains],
|
249 |
outputs=save_output
|
250 |
)
|
251 |
+
|
252 |
+
download_button = gr.Button("Download CSV")
|
253 |
+
download_file = gr.File(label="Download CSV")
|
|
|
|
|
254 |
|
255 |
+
download_button.click(
|
256 |
+
fn=gradio_download,
|
257 |
+
inputs=[],
|
258 |
+
outputs=download_file
|
259 |
+
)
|
260 |
|
261 |
+
# Launch the Gradio app
|
262 |
demo.launch()
|