HRNPH / AIwaifu

Open-Waifu open-sourced finetunable customizable simpable AI waifu inspired by neuro-sama
GNU General Public License v2.0
414 stars 29 forks source link

Multilingual Prompting #14

Open Adolfiux opened 1 year ago

Adolfiux 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)
HRNPH commented 1 year ago

Working on this rn, user should be able to config via config.json file or something