Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API
https://python-tgpt.onrender.com
MIT License
106 stars 15 forks source link

Speech Synthesis example #58

Closed fernandezbaran closed 1 month ago

fernandezbaran commented 1 month ago

Hello. Im trying to implement speech synthesis capabilities on a python script using the libary, so far I've tried, but got no sound.

from pytgpt.utils import Audio speech = Audio() speech.text_to_audio("Hello world")

Im pretty sure I'm mussunderstanding the usage of the library, so far I'm using a third party speech_recognition library to achieve the same fucntionality, I'have also tried the much more less elegant approach calling pytgpt binaries from os.system ... But I'd like to take advantages of the pytgpt built in capabilities in a propper way so If someone could provide an example to work with I will really apreciate it. Thanks for you time.

Simatwa commented 1 month ago
from pytgpt.utils import Audio
speech = Audio()
# Pass path to save the contents
speech.text_to_audio("Hello world", save_to="audio-test.mp3")
# Saved to current directory