I made an app, BuddyGPT, which takes the audio input from the user, translates into text, sends to Open AI, receives the response, sends to Eleven Labs, receives the response and plays the audio stream (automatically without a player).
It worked in the local system (Mac Book Pro), but when I uploaded to the Streamlit Community Cloud, it didn’t work.
I did some experiments and found that the Streamlit Community Cloud is not playing the audio automatically somehow. If I play with an audio player, it’s working.
Please let me know if anyone faced the same issue and possible workarounds!
If your Streamlit app, BuddyGPT, is not playing audio automatically on the Streamlit Community Cloud, but it works on your local system, there are a few possible workarounds you can try:
Use a different audio player library: Streamlit relies on the browser’s built-in audio player to play audio. However, different browsers may have varying support for different audio formats. Try using a different audio player library in your Streamlit app that is more compatible with a wider range of browsers. For example, you can try using the pydub library to convert the audio file into a compatible format before playing it.
Check the audio format: Verify that the audio file format you’re using is supported by the browsers used in the Streamlit Community Cloud. Some browsers may have limited support for certain audio formats. Consider converting the audio file to a widely supported format, such as MP3 or WAV, to ensure compatibility.
Buffer the audio: Instead of playing the audio file directly, you can try buffering the audio data and sending it to the browser in chunks. This can help mitigate any potential issues related to the audio file size or format. Streamlit’s st.audio function supports streaming audio data by using the audio parameter as a BytesIO object. You can read the audio file in chunks and pass the data to st.audio to play it.
Use an external audio player: If the above approaches don’t resolve the issue, consider using an external audio player within your Streamlit app. You can display a button or link in your app that, when clicked, opens the audio file in a separate audio player. This way, users can play the audio file using their system’s default audio player or a browser-compatible audio player.
Experiment with these workarounds to see if they help resolve the issue of audio not playing automatically on the Streamlit Community Cloud.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.