Skip to content

How do I specify the language for Kokoro? #558

@WesleyFister

Description

@WesleyFister

This is my code on ghcr.io/speaches-ai/speaches:0.8.2-cuda-12.4.1.

from pathlib import Path
from openai import OpenAI

openai = OpenAI(base_url="http://192.168.1.100:8000/v1", api_key="cant-be-empty")
model_id = "speaches-ai/Kokoro-82M-v1.0-ONNX"
voice_id = "jm_kumo"

res = openai.audio.speech.create(model=model_id,voice=voice_id,input="今日は月曜日で、夜の10時38分です。こんにちは。日本語で話します。とても静かな夜の時間ですね。",response_format="wav",speed=1)

with Path("output.wav").open("wb") as f:
    f.write(res.response.read())

When I listen to output.wav it does not sound like Japanese at all. I believe with Kokoro you have to specify which language to use or else it will try to speak it as English. Is there a way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions