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.
Here is the app: https://buddygpt.streamlit.app/
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.
@chiru-maddala I can’t access the app through your link, did you remove it?