| | --- |
| | language: |
| | - en |
| | thumbnail: >- |
| | https://user-images.githubusercontent.com/5068315/230698495-cbb1ced9-c911-4c9a-941d-a1a4a1286ac6.png |
| | library: bark |
| | tags: |
| | - audio |
| | - text-to-speech |
| | pipeline_tag: text-to-speech |
| | inference: true |
| | library_name: fairseq |
| | datasets: |
| | - lj_speech |
| | --- |
| | from gtts import gTTS |
| | from IPython.display import Audio |
| | from io import BytesIO |
| |
|
| | # Get user input |
| | text = input("Enter the text you want to convert to speech: ") |
| |
|
| | # Create a gTTS object and get audio as bytes |
| | tts = gTTS(text) |
| | audio_bytes = BytesIO() |
| | tts.write_to_fp(audio_bytes) |
| |
|
| | from IPython.display import Audio |
| |
|
| | # Replace 'your_audio_file.mp3' with the name of your audio file |
| | audio_path = '/content/welcome.mp3' |
| | |
| | # Play the audio |
| | Audio(audio_path) |