Open howardbaik opened 1 year ago
I'll defer to you, but I think adding reticulate as a dependency is a large lift for this package. If you do go this route, make sure it's a most a Suggests not Imports.
I agree that adding reticulate
is a heavy dependency for this package. And we have to decide whether text2speech
wants to call tts
through a virtual environment using reticulate
or keep it as is and just have the user use terminal to supply the path.
One benefit of using reticulate
to run tts
in Python is voice cloning:
Me and @cansavvy agree we can put this issue on the shelf while we work on other issues.
reticulate
to call tts
I was able to install tts
using reticulate
:
library(reticulate)
# Create a new environment
virtualenv_create("r-reticulate")
# Install TTS
virtualenv_install(packages = "TTS")
# Use r-reticulate as virtual environment
use_virtualenv("r-reticulate")
If you get this error message ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: https://github.com/urllib3/urllib3/issues/2168
, remove urllib3
and install urllib3<2.0
:
# Do `pip uninstall urllib3`
virtualenv_remove("urllib3")
# Do `pip install 'urllib3<2.0'`
virtualenv_install("urllib3<2.0")
Create a Python script (script.py):
from TTS.api import TTS
# List available 🐸TTS models and choose the first one
model_name = TTS.list_models()[0]
# Init TTS
tts = TTS(model_name)
# Run TTS
# Text to speech to a file
tts.tts_to_file(text="Hello world!", speaker=tts.speakers[0], language=tts.languages[0], file_path="output.wav")
⚠️ This crashes RStudio for some reason...
If we can't programmatically find
tts
, and the user knows thattts
isn't installed on their system, we install it for them withpip install tts
usingreticulate
Tasks
system2()
to properly locate thetts
exemenu()
: "Yes" or "No". If "Yes", install with reticulate pip install tts. If "No,", give them a warning message.