AlizerUncaged / desktop-waifu

Desktop Waifu!
346 stars 49 forks source link

Multilingual Prompting #1

Open cyberhome404 opened 1 year ago

cyberhome404 commented 1 year ago

I think we can use a simple function like this:

from utils.translate import *

# translating is optional
def translate_text(text):
    global is_Speaking
    # subtitle will act as subtitle for the viewer
    # subtitle = translate_google(text, "ID")

    # tts will be the string to be converted to audio
    detect = detect_google(text)
    # tts = translate_google(text, f"{detect}", "JA")
    tts = translate_google(text, f"{detect}", "JA")
    # tts_en = translate_google(text, f"{detect}", "EN")
    # tts_es = translate_google(text, f"{detect}", "ES")
    try:
        # print("ID Answer: " + subtitle)
        print("JP Answer: " + tts)
        # print("EN Answer: " + tts_en)
        # print("ES Answer: " + tts_es)
    except:
        print("Error translating text")
        return

This is from another AI Waifu code. You use your voice to talk with the AI and then translate the response from OpenAI API to Katakana (Japanese) to Voicevox (text-to-speech)

AlizerUncaged commented 1 year ago

Actually it's up to the characterAI's character if what language they are made, haven't experimented with elevenlabs tho

cyberhome404 commented 1 year ago

Is there a way to use Indonesia instead of English, I recently setup the code, I will be trying to do it but any help on this would be awesome.