Using the microphone input on Spaces is temperamental, often forwarding empty inputs to our function.
Response from @abidlabs:
So my hunch is that the audio component takes a little while to upload the recording to the backend and update its value. If you click the button before the audio upload is incomplete, then it will just send an empty value instead
This is going to be more pronounced on Spaces since there's additional latency involved in uploading the audio file
My suggestion would be to keep the button non-interactive and then define an audio.upload() event (that triggers after the upload is complete) to make the generate audio button interactive
In this demo, we expect the audio output component to return the same audio that we input (i.e. an identity function).
However, we see that the microphone input isn’t passed to the function in our demo, and thus the audio output is None
If you run this locally, you’ll find that the microphone input is passed to the identity function in our demo, and that it is returned as the output as expected
Describe the bug
Using the microphone input on Spaces is temperamental, often forwarding empty inputs to our function.
Response from @abidlabs:
Have you searched existing issues? 🔎
Reproduction
Created a reproducible example to showcase this: https://huggingface.co/spaces/sanchit-gandhi/audio-component
In this demo, we expect the audio output component to return the same audio that we input (i.e. an identity function).
However, we see that the microphone input isn’t passed to the function in our demo, and thus the audio output is
None
If you run this locally, you’ll find that the microphone input is passed to the identity function in our demo, and that it is returned as the output as expected
Screenshot
https://github.com/gradio-app/gradio/assets/93869735/8ceb7487-ad6f-4c5a-99f2-6a2eb20f06b9
Logs
No response
System Info
Severity
I can work around it