tts-vie-applio / convert_to_audio.py
Nông Văn Thắng
main
c4d0055
raw
history blame contribute delete
883 Bytes
import os
import sys
import subprocess
python = sys.executable
def run_tts_script(
tts_text: str,
tts_voice: str,
tts_rate: int,
output_tts_path: str,
):
tts_script_path = os.path.join("tts.py")
if os.path.exists(output_tts_path):
os.remove(output_tts_path)
command_tts = [
*map(
str,
[
python,
tts_script_path,
tts_text,
tts_voice,
tts_rate,
output_tts_path,
],
),
]
print(python)
print(tts_script_path)
print(tts_text)
print(tts_rate)
print(output_tts_path)
subprocess.run(command_tts)
def read_text_from_file(file_path):
with open(file_path, "r", encoding="utf-8") as file:
return file.read().strip()