Streamlit component that allows to convert text to speech and play it directly in the browser
Project description
streamlit-TTS
Streamlit component that allows you to convert text to speech and autoplay the audio directly.
Installation instructions
pip install streamlit-TTS
Usage instructions
import streamlit as st
from streamlit_TTS import auto_play, text_to_speech, text_to_audio
from gtts.lang import tts_langs
langs=tts_langs().keys()
#get the audio first
audio=text_to_audio("Choose a language, type some text, and click 'Speak it out!'.",language='en')
#then play it
auto_play(audio['bytes'])
lang=st.selectbox("Choose a language",options=langs)
text=st.text_input("Choose a text to speak out:")
speak=st.button("Speak it out!")
if lang and text and speak:
#plays the audio directly
text_to_speech(text=text, language=lang)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit_TTS-0.0.2.tar.gz
(440.7 kB
view hashes)
Built Distribution
streamlit_TTS-0.0.2-py3-none-any.whl
(444.7 kB
view hashes)
Close
Hashes for streamlit_TTS-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 565d69a7218db3bc4568a4d7da078b5c02343f43f1c92ff4f2f8e1caa50de7ea |
|
MD5 | 60cc7f962c32d7197013f30ebb1748d0 |
|
BLAKE2b-256 | b930dbdfcd1e6adc90a1bec6014094ad2cac36022e4f557081fa5b617282e815 |