Help with using pyaudio

Please guys, i need help with my streamlit app. I used pyaudio for getting audio input for my chatbot. It works on my local server but throws this error when the mic button is used for the deployed app:

OSError: No Default Input Device Available

That is because the deployment machine doesn’t have a mic. Streamlit doesn’t provide a way to send audio from the browser to the application, but there is a third party component that may help:

1 Like

This is a typical misunderstanding of how Streamlit works. When pyaudio wants to record/playback audio data, it accesses the audio hardware of the machine running the Streamlit application. But in the hosted environment, there is no audio-driver, no audio-hardware and no microphone. If you test this app locally, it happens to work because the client and server are identical, but once the Streamlit app is hosted, this approach is doomed to failure. Any user interaction in a Streamlit application must be done through the browser respectively browser APIs. That means you have to use a Streamlit component for audio recording/playback (and also any other hardware access on the clients side).

Thank you very much @Goyo

I will try it out now

Okay, @Franky1 . I understand now.

Thank you very much

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.