Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Audio] Unable to download streaming audio output #6570

Closed
1 task done
virajkarandikar opened this issue Nov 24, 2023 · 5 comments
Closed
1 task done

[Audio] Unable to download streaming audio output #6570

virajkarandikar opened this issue Nov 24, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@virajkarandikar
Copy link

Describe the bug

I am using an output audio block with streaming=True. I call yield audio chunks in my callback function. Audio playback works fine.
But when I try to download the audio, nothing happens. After few mins a zero size file gets downloaded.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
import numpy as np

def build_tts_ui():
    with gr.Blocks() as tts_ui:
        def generate_sine_tone(numsamples, sample_time, frequency):
            t = np.arange(numsamples) * sample_time # Time vector
            signal = 32767*np.sin(2*np.pi * frequency*t)
            return signal

        def text_to_speech():
            count = 5
            while count:
                signal = generate_sine_tone(16000, 1.0/16000, 440).astype(np.int16)
                count -= 1
                yield (16000, signal)

        synthesize_btn = gr.Button("Synthesize")
        output_audio = gr.Audio(label="Synthesized Speech", autoplay=True, show_edit_button=False, interactive=False, streaming=True)
        flag_btn = gr.Button("Flag")

        synthesize_btn.click(text_to_speech, None, [output_audio])

        tts_logger_callback = gr.CSVLogger()
        tts_logger_callback.setup([output_audio], "flagged/tts")
        flag_btn.click(lambda *args: tts_logger_callback.flag(args), [output_audio], None, preprocess=False, postprocess=False)

    return tts_ui


demo = build_tts_ui().queue()
demo.launch(server_name="0.0.0.0", server_port=7860)
# demo.launch(server_name="0.0.0.0", server_port=7860, share=False, ssl_certfile="cert/cert.pem", ssl_keyfile="cert/key.pem", ssl_verify=False, show_api=False)

Screenshot

No response

Logs

No activity is seen in the logs

System Info

Python 3.8
Gradio 4.7.1

Severity

Blocking usage of gradio

@virajkarandikar virajkarandikar added the bug Something isn't working label Nov 24, 2023
@virajkarandikar
Copy link
Author

Any update here?

@freddyaboulton freddyaboulton self-assigned this Dec 8, 2023
@virajkarandikar
Copy link
Author

any update on this?

@virajkarandikar
Copy link
Author

Ping...

@IguteChung
Copy link

+1

@abidlabs
Copy link
Member

Closed via #8906. If you'd like to try it out, you can install gradio from this branch: #8843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants