TTS API

#1
by dkounadis - opened

HF SPACE is also an API

# pip install gradio_client

from gradio_client import Client

# Call Dionyssos/speech-analysis2 as server & saves wavfile of TTS locally.

language_names = ['Ancient greek',
                  'English',
                  'Deutsch',
                  'French',
                  'Hungarian',
                  'Romanian',
                  'Serbian (Approx.)']

client = Client("Dionyssos/speech-analysis2", download_files='./local_tts_wav_files/')
wavfile = client.predict(
    text="Η γρηγορη καφετι αλεπου πειδαει πανω απο τον τεμπελη σκυλο.",
    lang=language_names[0],
    api_name="/audionar_tts")


print(f'Locally saved .wav {wavfile}')

# Affective TTS

client.predict(
    voice_filename="en_US_vctk_p326",  # https://huggingface.co/dkounadis/artificial-styletts2/discussions/1
    api_name="/update_selected_voice"
)

wavfile2 = client.predict(
    text='A quick brown fox jumps over the lazy dog.',
    api_name="/other_tts")


print(f'Locally saved .wav2 {wavfile2}')

Sign up or log in to comment