Open JackismyShephard opened 3 months ago
Thanks @JackismyShephard yes a repro would be very helpful here!
@abidlabs So I have finally managed to write a small script that reproduces the error in one scenario: when downloading audio from youtube and trying to load this audio:
import gradio as gr
import yt_dlp
def _yt_download(link: str) -> str:
link = link.split("&")[0]
outtmpl = "0_%(title)s_Original"
ydl_opts = {
"quiet": True,
"no_warnings": True,
"format": "bestaudio",
"outtmpl": outtmpl,
"ignoreerrors": True,
"nocheckcertificate": True,
"postprocessors": [
{
"key": "FFmpegExtractAudio",
"preferredcodec": "wav",
"preferredquality": 0,
}
],
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
result = ydl.extract_info(link, download=True)
download_path = ydl.prepare_filename(result, outtmpl=f"{outtmpl}.wav")
return download_path
with gr.Blocks(title="Ultimate RVC") as app:
audio_link = gr.Text(
label="Song link",
)
audio_output = gr.Audio(label="audio output", type="filepath", interactive=False)
audio_input = gr.Audio(label="audio_input", type="filepath")
retrieve_audio_btn = gr.Button("Retrieve audio", variant="primary")
retrieve_audio_btn.click(
_yt_download,
inputs=[audio_link],
outputs=[audio_output],
).success(
lambda v: gr.Audio(value=v),
inputs=[audio_output],
outputs=[audio_input],
)
if __name__ == "__main__":
app.launch()
The first time I try to load audio with this script, it is successful, but upon trying to load new audio, usually the second (and sometimes also the first) audio component do(es) not update. In this case the error seems to be due to chaining event listeners (the error also occurs when using the .then
method).
thanks @JackismyShephard! let me cc @hannahblair who is looking into audio component bugs
@abidlabs @hannahblair Are there any updates on this issue?
Hi. I am also looking for a solution to this issue. I am experiencing it locally - running Gradio on Windows and Ubuntu. My use case involves users either recording audio or uploading their own .wav files.
Specifically, this bug occurs when I add example .wav files to the interface and users select examples to load. The examples are usually no longer than 2 minutes each. After the user selects two or three examples the Gradio UI becomes very sluggish uploading or recording any new audio files. A peek into the browser console log shows numerous pending calls to "upload". In my command line, where Gradio is running, I receive a "Response content shorter than Content-Length" error, similar to the original post of this issue.
Any update on this? I get the same error already with the minimal code
import gradio as gr
with gr.Blocks() as demo:
audio = gr.Audio(sources="microphone", type="filepath", scale=1)
demo.launch(inbrowser=True)
Errors are particularly likely to be triggered by short audio.
Describe the bug
I am developing a gradio app with many instantiations of the
Audio
components (think 10+). I have observed thatAudio
components serving as output for event listener functions load new audio (in my case represented using file paths) very slowly and in some cases will not be able to load the new audio at all. In these cases I am getting aRuntimeError: Response content shorter than Content-Length
in my terminal. A similar issue has been reported before at https://github.com/gradio-app/gradio/issues/8351 and (partially) at https://github.com/gradio-app/gradio/issues/7155.Have you searched existing issues? π
Reproduction
This is a bit hard at the moment as the relevant code is quite large and complex, but I can work on trying to reproduce the behaviour in a simple script if that is necessary.
Screenshot
Logs
System Info
Severity
I can work around it