TTS API

#1
by dkounadis - opened
from gradio_client import Client # pip install gradio-client
client = Client("Dionyssos/speech-analysis2", download_files='./save_wav_files_TTS/')
wavfile = client.predict(
        text="Η γρηγορη καφετι αλεπου πειδαει πανω απο τον τεμπελη σκυλο.",
        lang="jv_ID_google-gmu_04982", #https://huggingface.co/spaces/Dionyssos/SHIFT
        soundscape="swims in lake frogs",
        cache_lim=24,
        api_name="/audionar_tts")
print(wavfile)

Legacy API

HF SPACE is also an API

This API only performs TTS thus has no sounds of AudioGen!

# pip install gradio_client

from gradio_client import Client

# Save wavfile of TTS locally

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

client = Client("dkounadis/__TTS", 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