Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -159,7 +159,7 @@ def get_response(question):
|
|
159 |
|
160 |
# Define the function to clear input and output
|
161 |
def clear_fields():
|
162 |
-
return "", ""
|
163 |
|
164 |
# Function to generate audio with Eleven Labs TTS
|
165 |
def generate_audio_elevenlabs(text):
|
@@ -188,11 +188,12 @@ def generate_audio_elevenlabs(text):
|
|
188 |
f.write(chunk)
|
189 |
audio_path = f.name
|
190 |
logging.debug(f"Audio saved to {audio_path}")
|
191 |
-
return audio_path
|
192 |
else:
|
193 |
logging.error(f"Error generating audio: {response.text}")
|
194 |
return None
|
195 |
|
|
|
196 |
# Create the Gradio Blocks interface
|
197 |
with gr.Blocks() as demo:
|
198 |
with gr.Row():
|
@@ -207,7 +208,7 @@ with gr.Blocks() as demo:
|
|
207 |
question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
|
208 |
|
209 |
with gr.Column():
|
210 |
-
audio_output = gr.Audio(label="Audio", type="filepath", interactive=
|
211 |
|
212 |
with gr.Row():
|
213 |
with gr.Column():
|
|
|
159 |
|
160 |
# Define the function to clear input and output
|
161 |
def clear_fields():
|
162 |
+
return "", "",None
|
163 |
|
164 |
# Function to generate audio with Eleven Labs TTS
|
165 |
def generate_audio_elevenlabs(text):
|
|
|
188 |
f.write(chunk)
|
189 |
audio_path = f.name
|
190 |
logging.debug(f"Audio saved to {audio_path}")
|
191 |
+
return audio_path # Return audio path for automatic playback
|
192 |
else:
|
193 |
logging.error(f"Error generating audio: {response.text}")
|
194 |
return None
|
195 |
|
196 |
+
|
197 |
# Create the Gradio Blocks interface
|
198 |
with gr.Blocks() as demo:
|
199 |
with gr.Row():
|
|
|
208 |
question_input = gr.Textbox(label="Ask a Question", placeholder="Type your question here...")
|
209 |
|
210 |
with gr.Column():
|
211 |
+
audio_output = gr.Audio(label="Audio", type="filepath", interactive=True)
|
212 |
|
213 |
with gr.Row():
|
214 |
with gr.Column():
|