Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,7 +97,7 @@ def main(audio, doctor_name, location):
|
|
97 |
answers.insert(0, location) # Add location
|
98 |
answers.insert(0, doctor_name) # Add doctor name
|
99 |
|
100 |
-
return
|
101 |
|
102 |
def save_answers(*args):
|
103 |
current_datetime = datetime.now().isoformat()
|
@@ -164,7 +164,10 @@ with gr.Blocks() as demo:
|
|
164 |
submit_button = gr.Button("Submit")
|
165 |
info_output = gr.HTML(label="Submitted Info")
|
166 |
|
167 |
-
|
|
|
|
|
|
|
168 |
|
169 |
# Second tab for OHA Form
|
170 |
with gr.Tab("OHA Form"):
|
@@ -173,15 +176,29 @@ with gr.Blocks() as demo:
|
|
173 |
|
174 |
with gr.Row(elem_id="textboxes_row"):
|
175 |
with gr.Column():
|
176 |
-
|
|
|
|
|
177 |
with gr.Column():
|
178 |
-
textboxes_right = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=
|
179 |
dropdown_referred = gr.Dropdown(choices=["NONE","ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], label="Referred to", interactive=True)
|
180 |
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
183 |
output_html = gr.HTML(label="Submitted Answers")
|
184 |
-
submit_button.click(fn=save_answers, inputs=textboxes_left + textboxes_right + [dropdown_referred], outputs=output_html)
|
185 |
|
186 |
# Third tab for CSV download
|
187 |
with gr.Tab("Download CSV"):
|
|
|
97 |
answers.insert(0, location) # Add location
|
98 |
answers.insert(0, doctor_name) # Add doctor name
|
99 |
|
100 |
+
return answers
|
101 |
|
102 |
def save_answers(*args):
|
103 |
current_datetime = datetime.now().isoformat()
|
|
|
164 |
submit_button = gr.Button("Submit")
|
165 |
info_output = gr.HTML(label="Submitted Info")
|
166 |
|
167 |
+
def submit_info(name, loc):
|
168 |
+
return f"Doctor's Name: {name}<br>Location: {loc}"
|
169 |
+
|
170 |
+
submit_button.click(fn=submit_info, inputs=[doctor_name_input, location_input], outputs=info_output)
|
171 |
|
172 |
# Second tab for OHA Form
|
173 |
with gr.Tab("OHA Form"):
|
|
|
176 |
|
177 |
with gr.Row(elem_id="textboxes_row"):
|
178 |
with gr.Column():
|
179 |
+
doctor_name_display = gr.Textbox(label="Doctor’s Name", value="", interactive=False)
|
180 |
+
location_display = gr.Textbox(label="Location", value="", interactive=False)
|
181 |
+
textboxes_left = [gr.Textbox(label=oral_health_assessment_form[i], value="", interactive=True) for i in range(2, len(oral_health_assessment_form)//2)]
|
182 |
with gr.Column():
|
183 |
+
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)]
|
184 |
dropdown_referred = gr.Dropdown(choices=["NONE","ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], label="Referred to", interactive=True)
|
185 |
|
186 |
+
def update_textboxes(audio, doctor_name, location):
|
187 |
+
context = transcribe_audio(audio)
|
188 |
+
|
189 |
+
if "Error" in context:
|
190 |
+
return [context] * (len(oral_health_assessment_form) - 2) # Adjust for the number of fields
|
191 |
+
|
192 |
+
answers = fill_textboxes(context)
|
193 |
+
answers.insert(0, location) # Add location
|
194 |
+
answers.insert(0, doctor_name) # Add doctor name
|
195 |
+
|
196 |
+
return [doctor_name, location] + answers
|
197 |
+
|
198 |
+
transcribe_button.click(fn=update_textboxes, inputs=[audio_input, doctor_name_input, location_input], outputs=[doctor_name_display, location_display] + textboxes_left + textboxes_right)
|
199 |
submit_button = gr.Button("Submit", elem_id="submit_button")
|
200 |
output_html = gr.HTML(label="Submitted Answers")
|
201 |
+
submit_button.click(fn=save_answers, inputs=[doctor_name_display, location_display] + textboxes_left + textboxes_right + [dropdown_referred], outputs=output_html)
|
202 |
|
203 |
# Third tab for CSV download
|
204 |
with gr.Tab("Download CSV"):
|