Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ question_answerer = pipeline("question-answering", model='distilbert-base-cased-
|
|
| 16 |
|
| 17 |
# List of questions
|
| 18 |
questions = [
|
|
|
|
| 19 |
"How old is the patient?",
|
| 20 |
"What is the gender?",
|
| 21 |
"What is the chief complaint regarding the patient's oral health? If there is none, just say the word 'none' else elaborate",
|
|
@@ -29,13 +30,14 @@ questions = [
|
|
| 29 |
oral_health_assessment_form = [
|
| 30 |
"Doctor’s Name",
|
| 31 |
"Child’s Name",
|
|
|
|
| 32 |
"Age",
|
| 33 |
"Gender",
|
| 34 |
"Chief complaint",
|
| 35 |
"Medical history",
|
| 36 |
"Dental history",
|
| 37 |
"Clinical Findings",
|
| 38 |
-
"
|
| 39 |
"Treatment plan",
|
| 40 |
"Referred to"
|
| 41 |
]
|
|
@@ -93,13 +95,13 @@ def main(audio):
|
|
| 93 |
context = transcribe_audio(audio)
|
| 94 |
|
| 95 |
if "Error" in context:
|
| 96 |
-
return [context] * len(oral_health_assessment_form)
|
| 97 |
|
| 98 |
answers = fill_textboxes(context)
|
| 99 |
answers.insert(0, "") # for "Child's Name"
|
| 100 |
answers.insert(0, "Dr.Alvi") # for "Doctor’s Name"
|
| 101 |
|
| 102 |
-
return answers
|
| 103 |
|
| 104 |
def save_answers(*args):
|
| 105 |
current_datetime = datetime.now().isoformat()
|
|
@@ -164,23 +166,14 @@ with gr.Blocks() as demo:
|
|
| 164 |
with gr.Column():
|
| 165 |
textboxes_left = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=True) for i in range(0, len(oral_health_assessment_form)//2)]
|
| 166 |
with gr.Column():
|
| 167 |
-
textboxes_right = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=True) for i in range(len(oral_health_assessment_form)//2, len(oral_health_assessment_form))]
|
| 168 |
-
|
| 169 |
-
referred_to = gr.Dropdown(label="Referred to", choices=[
|
| 170 |
-
"ORAL MEDICINE & RADIOLOGY",
|
| 171 |
-
"PERIODONTICS",
|
| 172 |
-
"ORAL SURGERY",
|
| 173 |
-
"CONSERVATIVE AND ENDODONTICS",
|
| 174 |
-
"PROSTHODONTICS",
|
| 175 |
-
"PEDODONTICS",
|
| 176 |
-
"ORTHODONTICS"
|
| 177 |
-
], value="", interactive=True)
|
| 178 |
|
| 179 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
| 180 |
output_html = gr.HTML(label="Submitted Answers")
|
| 181 |
|
| 182 |
-
transcribe_button.click(fn=main, inputs=audio_input, outputs=textboxes_left + textboxes_right
|
| 183 |
-
submit_button.click(fn=save_answers, inputs=textboxes_left + textboxes_right + [
|
| 184 |
|
| 185 |
download_button = gr.Button("Download Table as CSV")
|
| 186 |
download_csv_output = gr.File(label="Download CSV")
|
|
@@ -188,4 +181,4 @@ with gr.Blocks() as demo:
|
|
| 188 |
download_button.click(fn=gradio_download, inputs=[], outputs=download_csv_output)
|
| 189 |
|
| 190 |
# Launch the app
|
| 191 |
-
demo.launch(
|
|
|
|
| 16 |
|
| 17 |
# List of questions
|
| 18 |
questions = [
|
| 19 |
+
"Which grade is the patient studying?",
|
| 20 |
"How old is the patient?",
|
| 21 |
"What is the gender?",
|
| 22 |
"What is the chief complaint regarding the patient's oral health? If there is none, just say the word 'none' else elaborate",
|
|
|
|
| 30 |
oral_health_assessment_form = [
|
| 31 |
"Doctor’s Name",
|
| 32 |
"Child’s Name",
|
| 33 |
+
"Grade",
|
| 34 |
"Age",
|
| 35 |
"Gender",
|
| 36 |
"Chief complaint",
|
| 37 |
"Medical history",
|
| 38 |
"Dental history",
|
| 39 |
"Clinical Findings",
|
| 40 |
+
"Any other finding",
|
| 41 |
"Treatment plan",
|
| 42 |
"Referred to"
|
| 43 |
]
|
|
|
|
| 95 |
context = transcribe_audio(audio)
|
| 96 |
|
| 97 |
if "Error" in context:
|
| 98 |
+
return [context] * (len(oral_health_assessment_form) - 1)
|
| 99 |
|
| 100 |
answers = fill_textboxes(context)
|
| 101 |
answers.insert(0, "") # for "Child's Name"
|
| 102 |
answers.insert(0, "Dr.Alvi") # for "Doctor’s Name"
|
| 103 |
|
| 104 |
+
return answers
|
| 105 |
|
| 106 |
def save_answers(*args):
|
| 107 |
current_datetime = datetime.now().isoformat()
|
|
|
|
| 166 |
with gr.Column():
|
| 167 |
textboxes_left = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=True) for i in range(0, len(oral_health_assessment_form)//2)]
|
| 168 |
with gr.Column():
|
| 169 |
+
textboxes_right = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=True) for i in range(len(oral_health_assessment_form)//2, len(oral_health_assessment_form)-1)]
|
| 170 |
+
dropdown_referred = gr.Dropdown(choices=["ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS", "none"], label="Referred to", interactive=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
| 173 |
output_html = gr.HTML(label="Submitted Answers")
|
| 174 |
|
| 175 |
+
transcribe_button.click(fn=main, inputs=audio_input, outputs=textboxes_left + textboxes_right)
|
| 176 |
+
submit_button.click(fn=save_answers, inputs=textboxes_left + textboxes_right + [dropdown_referred], outputs=output_html)
|
| 177 |
|
| 178 |
download_button = gr.Button("Download Table as CSV")
|
| 179 |
download_csv_output = gr.File(label="Download CSV")
|
|
|
|
| 181 |
download_button.click(fn=gradio_download, inputs=[], outputs=download_csv_output)
|
| 182 |
|
| 183 |
# Launch the app
|
| 184 |
+
demo.launch()
|