Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,7 +62,6 @@ oral_health_assessment_form = [
|
|
| 62 |
"Any other finding",
|
| 63 |
"Treatment plan",
|
| 64 |
]
|
| 65 |
-
|
| 66 |
# Function to generate answers for the questions
|
| 67 |
def generate_answer(question, context):
|
| 68 |
result = question_answerer(question=question, context=context)
|
|
@@ -142,6 +141,10 @@ def save_answers(*args):
|
|
| 142 |
# Create the Gradio interface
|
| 143 |
with gr.Blocks() as demo:
|
| 144 |
gr.Markdown("# OHA Form Filler App")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
audio_input = gr.Audio(type="filepath", label="Record your audio", elem_id="audio_input")
|
| 146 |
transcribe_button = gr.Button("Transcribe and Generate Form", elem_id="transcribe_button")
|
| 147 |
|
|
@@ -154,8 +157,16 @@ with gr.Blocks() as demo:
|
|
| 154 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
| 155 |
output_html = gr.HTML(label="Submitted Answers")
|
| 156 |
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
submit_button.click(fn=save_answers, inputs=textboxes_left + textboxes_right, outputs=output_html)
|
| 159 |
|
| 160 |
# Launch the app
|
| 161 |
-
demo.launch(share=True)
|
|
|
|
| 62 |
"Any other finding",
|
| 63 |
"Treatment plan",
|
| 64 |
]
|
|
|
|
| 65 |
# Function to generate answers for the questions
|
| 66 |
def generate_answer(question, context):
|
| 67 |
result = question_answerer(question=question, context=context)
|
|
|
|
| 141 |
# Create the Gradio interface
|
| 142 |
with gr.Blocks() as demo:
|
| 143 |
gr.Markdown("# OHA Form Filler App")
|
| 144 |
+
|
| 145 |
+
# Add HTML box to show the status
|
| 146 |
+
status_box = gr.HTML("<div id='status_box' style='width: 100px; height: 30px; background-color: red;'></div>")
|
| 147 |
+
|
| 148 |
audio_input = gr.Audio(type="filepath", label="Record your audio", elem_id="audio_input")
|
| 149 |
transcribe_button = gr.Button("Transcribe and Generate Form", elem_id="transcribe_button")
|
| 150 |
|
|
|
|
| 157 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
| 158 |
output_html = gr.HTML(label="Submitted Answers")
|
| 159 |
|
| 160 |
+
# Update status box color based on audio input
|
| 161 |
+
def update_status(audio):
|
| 162 |
+
if audio:
|
| 163 |
+
status_box_value = "<div id='status_box' style='width: 100px; height: 30px; background-color: green;'></div>"
|
| 164 |
+
else:
|
| 165 |
+
status_box_value = "<div id='status_box' style='width: 100px; height: 30px; background-color: red;'></div>"
|
| 166 |
+
return status_box_value, main(audio)
|
| 167 |
+
|
| 168 |
+
transcribe_button.click(fn=update_status, inputs=audio_input, outputs=[status_box, textboxes_left + textboxes_right])
|
| 169 |
submit_button.click(fn=save_answers, inputs=textboxes_left + textboxes_right, outputs=output_html)
|
| 170 |
|
| 171 |
# Launch the app
|
| 172 |
+
demo.launch(share=True)
|