Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing VC Model Via API | Python TTS Generation Examples? #11

Open
ArianaStar opened this issue Jul 19, 2023 · 1 comment
Open

Changing VC Model Via API | Python TTS Generation Examples? #11

ArianaStar opened this issue Jul 19, 2023 · 1 comment

Comments

@ArianaStar
Copy link

Changing the VC model via API doesn't work, however, changing the speaker does. Is there any way to generate TTS without the Gradio API? or could you please provide some *.py use case examples? tysm.

@matrHS
Copy link

matrHS commented Aug 5, 2023

Hey, I managed with a lot of trial and error to create a python script to generate TTS messages from one program to another one.
Since the APIs arent named its required to use the fn_index (function index).

This is my very basic .py script but it works.
It always runs the SetLang fucntion first because the generating of Text To Speech fails unless a language model is set first

The way I use the script is that I removed the SetLang() and GenTTS() from the bottom and just imported my script into another program to just call the functions individually controlling the logic from there instead. It works well changing the loaded models and speakers from the other script.

The fn_index=X at the bottom of the functions just define that it wants to use that specific endpoint. I'm sure there is a way to name the endpoints in the original code but i have close to 0 experience with Gradio so I wouldnt know how. Hope this helps!

from gradio_client import Client

def SetLang(): 
    client = Client("http://127.0.0.1:7860/")
    result = client.predict(
    				"en",	# str (Option from: ['en', 'ja']) in 'Languages' Dropdown component
    				fn_index=0
    )
    print(result)


def GenTTS(lang="en", msg="test msg", speaker="speaker14", conv="No conversion", pitch=0,method="harvest",speed=1):
    client = Client("http://127.0.0.1:7860/")
    result = client.predict(
    				lang,	# str (Option from: ['en', 'ja']) in 'Languages' Dropdown component
    				msg,	# str in 'Text' Textbox component
    				speaker,	# str (Option from: []) in 'Speaker' Dropdown component
    				conv,	# str (Option from: ['No conversion', 'Forsen', 'ForsenRVC1']) in 'Voice Conversion' Dropdown component
    				pitch,	# int | float (numeric value between -12 and 12) in 'Pitch' Slider component
    				method,	# str in 'Pitch Method pm: speed-oriented, harvest: accuracy-oriented' Radio component
    				speed,	# int | float (numeric value between 0.1 and 2) in 'Speed' Slider component
    				fn_index=3
    )
    return(result[1])

SetLang()
print(GenTTS())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants