Hi @my-projects-it, I explored this application and found it truly inspiring. I’d love to suggest a new feature to enhance the experience, a Narration Mode, as many users often prefer listening to stories rather than reading them.
I've outlined the idea in detail below. Looking forward to your thoughts and discuss it further!
Overview
Add an optional Text-to-Speech (TTS) feature to allow users to listen to submitted stories. This improves accessibility and emotional impact, especially for visually impaired users or those who prefer auditory experiences.
What it Does
- Adds a “Listen to this story” button under each text submission
- Converts the story content into speech using a soothing, language-appropriate voice
- Plays the audio inline within the Streamlit app
Technical Implementation
Packages
gTTS – Google Text-to-Speech for multilingual support (supports Hindi, Tamil, Bengali, etc.)
tempfile – for managing temporary audio file storage
Streamlit's st.audio() – to play audio in-browser
Steps to Implement
-
Create a button:
if st.button(" Listen to this story"):
-
Convert story text to speech using gTTS:
from gtts import gTTS
import tempfile
tts = gTTS(text=story_text, lang="hi") # or "en", "ta", etc.
temp_audio = tempfile.NamedTemporaryFile(delete=False, suffix=".mp3")
tts.save(temp_audio.name)
-
Play audio in Streamlit:
st.audio(temp_audio.name)
-
Clean up temp files periodically:
You can use a cleanup script or schedule to delete old audio files.
Hi @my-projects-it, I explored this application and found it truly inspiring. I’d love to suggest a new feature to enhance the experience, a Narration Mode, as many users often prefer listening to stories rather than reading them.
I've outlined the idea in detail below. Looking forward to your thoughts and discuss it further!
Overview
Add an optional Text-to-Speech (TTS) feature to allow users to listen to submitted stories. This improves accessibility and emotional impact, especially for visually impaired users or those who prefer auditory experiences.
What it Does
Technical Implementation
Packages
gTTS– Google Text-to-Speech for multilingual support (supports Hindi, Tamil, Bengali, etc.)tempfile– for managing temporary audio file storageStreamlit's st.audio()– to play audio in-browserSteps to Implement
Create a button:
if st.button(" Listen to this story"):
Convert story text to speech using gTTS:
from gtts import gTTS
import tempfile
tts = gTTS(text=story_text, lang="hi") # or "en", "ta", etc.
temp_audio = tempfile.NamedTemporaryFile(delete=False, suffix=".mp3")
tts.save(temp_audio.name)
Play audio in Streamlit:
st.audio(temp_audio.name)
Clean up temp files periodically:
You can use a cleanup script or schedule to delete old audio files.