gauravgulati619 commited on
Commit
9943a83
·
1 Parent(s): cc751de

Fix: Update audio handling in Gradio interface

Browse files
Files changed (2) hide show
  1. .gitignore +1 -1
  2. app.py +5 -3
.gitignore CHANGED
@@ -10,7 +10,7 @@ __pycache__/
10
  *.wav
11
  *.jpg
12
  download.jpg
13
- Temp.mp3
14
  final.mp3
15
  patient_voice.mp3
16
 
 
10
  *.wav
11
  *.jpg
12
  download.jpg
13
+ output_audio.mp3
14
  final.mp3
15
  patient_voice.mp3
16
 
app.py CHANGED
@@ -130,9 +130,11 @@ def process_inputs(audio_filepath, image_filepath):
130
  else:
131
  doctor_response = "No image provided for me to analyze"
132
 
133
- voice_of_doctor = text_to_speech_with_elevenlabs(input_text=doctor_response, output_filepath="final.mp3")
 
 
134
 
135
- return speech_to_text_output, doctor_response, voice_of_doctor
136
 
137
 
138
  # Create the interface
@@ -145,7 +147,7 @@ iface = gr.Interface(
145
  outputs=[
146
  gr.Textbox(label="Speech to Text"),
147
  gr.Textbox(label="Doctor's Response"),
148
- gr.Audio("Temp.mp3")
149
  ],
150
  title="AI Doctor with Vision and Voice"
151
  )
 
130
  else:
131
  doctor_response = "No image provided for me to analyze"
132
 
133
+ # Generate audio response and return the filepath
134
+ output_filepath = "output_audio.mp3"
135
+ voice_of_doctor = text_to_speech_with_elevenlabs(input_text=doctor_response, output_filepath=output_filepath)
136
 
137
+ return speech_to_text_output, doctor_response, output_filepath
138
 
139
 
140
  # Create the interface
 
147
  outputs=[
148
  gr.Textbox(label="Speech to Text"),
149
  gr.Textbox(label="Doctor's Response"),
150
+ gr.Audio(label="Doctor's Voice")
151
  ],
152
  title="AI Doctor with Vision and Voice"
153
  )