Update app.py
Browse files
app.py
CHANGED
@@ -278,21 +278,21 @@ with gr.Blocks() as demo:
|
|
278 |
|
279 |
with gr.Tab("Voice Chat"):
|
280 |
with gr.Tabs():
|
281 |
-
with gr.Tab("Upload Audio"):
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
|
290 |
with gr.Tab("Record Audio"):
|
291 |
# Record audio section - Fixed to use compatible parameters
|
292 |
audio_recorder = gr.Audio(label="Record your voice", type="filepath")
|
293 |
record_transcribe_button = gr.Button("Transcribe Recording", elem_id="transcribe_button")
|
294 |
record_transcription = gr.Textbox(label="Transcription", interactive=False)
|
295 |
-
record_audio_query = gr.Textbox(label="Ask about the transcription (optional)")
|
296 |
record_audio_output = gr.Textbox(label="Response", interactive=False)
|
297 |
record_audio_button = gr.Button("Ask", elem_id="ask_button")
|
298 |
|
@@ -307,17 +307,17 @@ with gr.Blocks() as demo:
|
|
307 |
pdf_button.click(pdf_chat, [pdf_upload, pdf_text_query, temperature, top_p, max_output_tokens], pdf_output)
|
308 |
|
309 |
# Voice Chat - Upload Audio tab actions
|
310 |
-
upload_transcribe_button.click(
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
)
|
315 |
|
316 |
-
upload_audio_button.click(
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
)
|
321 |
|
322 |
# Voice Chat - Record Audio tab actions
|
323 |
record_transcribe_button.click(
|
@@ -328,7 +328,8 @@ with gr.Blocks() as demo:
|
|
328 |
|
329 |
record_audio_button.click(
|
330 |
process_voice_query,
|
331 |
-
|
|
|
332 |
outputs=[record_audio_output]
|
333 |
)
|
334 |
|
|
|
278 |
|
279 |
with gr.Tab("Voice Chat"):
|
280 |
with gr.Tabs():
|
281 |
+
# with gr.Tab("Upload Audio"):
|
282 |
+
# # Upload audio section
|
283 |
+
# audio_upload = gr.File(label="Upload an Audio File", type="binary")
|
284 |
+
# upload_transcribe_button = gr.Button("Transcribe Audio", elem_id="transcribe_button")
|
285 |
+
# upload_transcription = gr.Textbox(label="Transcription", interactive=False)
|
286 |
+
# upload_audio_query = gr.Textbox(label="Ask about the transcription (optional)")
|
287 |
+
# upload_audio_output = gr.Textbox(label="Response", interactive=False)
|
288 |
+
# upload_audio_button = gr.Button("Ask", elem_id="ask_button")
|
289 |
|
290 |
with gr.Tab("Record Audio"):
|
291 |
# Record audio section - Fixed to use compatible parameters
|
292 |
audio_recorder = gr.Audio(label="Record your voice", type="filepath")
|
293 |
record_transcribe_button = gr.Button("Transcribe Recording", elem_id="transcribe_button")
|
294 |
record_transcription = gr.Textbox(label="Transcription", interactive=False)
|
295 |
+
# record_audio_query = gr.Textbox(label="Ask about the transcription (optional)")
|
296 |
record_audio_output = gr.Textbox(label="Response", interactive=False)
|
297 |
record_audio_button = gr.Button("Ask", elem_id="ask_button")
|
298 |
|
|
|
307 |
pdf_button.click(pdf_chat, [pdf_upload, pdf_text_query, temperature, top_p, max_output_tokens], pdf_output)
|
308 |
|
309 |
# Voice Chat - Upload Audio tab actions
|
310 |
+
# upload_transcribe_button.click(
|
311 |
+
# process_uploaded_audio,
|
312 |
+
# inputs=[audio_upload],
|
313 |
+
# outputs=[upload_transcription]
|
314 |
+
# )
|
315 |
|
316 |
+
# upload_audio_button.click(
|
317 |
+
# process_voice_query,
|
318 |
+
# inputs=[upload_transcription, upload_audio_query, temperature, top_p, max_output_tokens],
|
319 |
+
# outputs=[upload_audio_output]
|
320 |
+
# )
|
321 |
|
322 |
# Voice Chat - Record Audio tab actions
|
323 |
record_transcribe_button.click(
|
|
|
328 |
|
329 |
record_audio_button.click(
|
330 |
process_voice_query,
|
331 |
+
# Modified to use an empty string for the query parameter since we commented out the field
|
332 |
+
inputs=[record_transcription, "", temperature, top_p, max_output_tokens],
|
333 |
outputs=[record_audio_output]
|
334 |
)
|
335 |
|