NikilDGr8 commited on
Commit
518953a
1 Parent(s): af938ba

added disable button for audio

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -208,7 +208,7 @@ with gr.Blocks() as demo:
208
  # Second tab for OHA Form
209
  with gr.Tab("OHA Form"):
210
  audio_input = gr.Audio(type="filepath", label="Record your audio", elem_id="audio_input")
211
- transcribe_button = gr.Button("Transcribe and Generate Form", elem_id="transcribe_button")
212
 
213
  with gr.Row(elem_id="textboxes_row"):
214
  with gr.Column():
@@ -220,6 +220,11 @@ with gr.Blocks() as demo:
220
  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)]
221
  dropdown_referred = gr.Dropdown(choices=["NONE","ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], label="Referred to", interactive=True)
222
 
 
 
 
 
 
223
  def update_textboxes(audio, doctor_name, location):
224
  context = transcribe_audio(audio)
225
 
@@ -252,3 +257,4 @@ with gr.Blocks() as demo:
252
 
253
  # Run the Gradio app
254
  demo.launch()
 
 
208
  # Second tab for OHA Form
209
  with gr.Tab("OHA Form"):
210
  audio_input = gr.Audio(type="filepath", label="Record your audio", elem_id="audio_input")
211
+ transcribe_button = gr.Button("Transcribe and Generate Form", elem_id="transcribe_button", interactive=False)
212
 
213
  with gr.Row(elem_id="textboxes_row"):
214
  with gr.Column():
 
220
  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)]
221
  dropdown_referred = gr.Dropdown(choices=["NONE","ORAL MEDICINE & RADIOLOGY", "PERIODONTICS", "ORAL SURGERY", "CONSERVATIVE AND ENDODONTICS", "PROSTHODONTICS", "PEDODONTICS", "ORTHODONTICS"], label="Referred to", interactive=True)
222
 
223
+ def enable_transcribe_button(audio_path):
224
+ return gr.update(interactive=True)
225
+
226
+ audio_input.change(fn=enable_transcribe_button, inputs=audio_input, outputs=transcribe_button)
227
+
228
  def update_textboxes(audio, doctor_name, location):
229
  context = transcribe_audio(audio)
230
 
 
257
 
258
  # Run the Gradio app
259
  demo.launch()
260
+