mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
Replaced default voice with af_heart as af doesn't exist
This commit is contained in:
parent
8c457c3292
commit
4802128943
7 changed files with 11 additions and 11 deletions
|
@ -54,7 +54,7 @@ class OpenAISpeechRequest(BaseModel):
|
||||||
)
|
)
|
||||||
input: str = Field(..., description="The text to generate audio for")
|
input: str = Field(..., description="The text to generate audio for")
|
||||||
voice: str = Field(
|
voice: str = Field(
|
||||||
default="af",
|
default="af_heart",
|
||||||
description="The voice to use for generation. Can be a base voice or a combined voice name.",
|
description="The voice to use for generation. Can be a base voice or a combined voice name.",
|
||||||
)
|
)
|
||||||
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] = Field(
|
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] = Field(
|
||||||
|
@ -98,7 +98,7 @@ class CaptionedSpeechRequest(BaseModel):
|
||||||
)
|
)
|
||||||
input: str = Field(..., description="The text to generate audio for")
|
input: str = Field(..., description="The text to generate audio for")
|
||||||
voice: str = Field(
|
voice: str = Field(
|
||||||
default="af",
|
default="af_heart",
|
||||||
description="The voice to use for generation. Can be a base voice or a combined voice name.",
|
description="The voice to use for generation. Can be a base voice or a combined voice name.",
|
||||||
)
|
)
|
||||||
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] = Field(
|
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] = Field(
|
||||||
|
|
|
@ -34,7 +34,7 @@ def measure_first_token(
|
||||||
json={
|
json={
|
||||||
"model": "kokoro",
|
"model": "kokoro",
|
||||||
"input": text,
|
"input": text,
|
||||||
"voice": "af",
|
"voice": "af_heart",
|
||||||
"response_format": "wav",
|
"response_format": "wav",
|
||||||
"stream": False,
|
"stream": False,
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ def measure_first_token_requests(
|
||||||
json={
|
json={
|
||||||
"model": "kokoro",
|
"model": "kokoro",
|
||||||
"input": text,
|
"input": text,
|
||||||
"voice": "af",
|
"voice": "af_heart",
|
||||||
"response_format": "pcm",
|
"response_format": "pcm",
|
||||||
"stream": True,
|
"stream": True,
|
||||||
},
|
},
|
||||||
|
@ -123,7 +123,7 @@ def measure_first_token_openai(
|
||||||
# Make streaming request using OpenAI client
|
# Make streaming request using OpenAI client
|
||||||
with OPENAI_CLIENT.audio.speech.with_streaming_response.create(
|
with OPENAI_CLIENT.audio.speech.with_streaming_response.create(
|
||||||
model="kokoro",
|
model="kokoro",
|
||||||
voice="af",
|
voice="af_heart",
|
||||||
response_format="pcm",
|
response_format="pcm",
|
||||||
input=text,
|
input=text,
|
||||||
) as response:
|
) as response:
|
||||||
|
|
|
@ -56,7 +56,7 @@ def make_tts_request(
|
||||||
json={
|
json={
|
||||||
"model": "kokoro",
|
"model": "kokoro",
|
||||||
"input": text,
|
"input": text,
|
||||||
"voice": "af",
|
"voice": "af_heart",
|
||||||
"response_format": "wav",
|
"response_format": "wav",
|
||||||
"stream": True,
|
"stream": True,
|
||||||
},
|
},
|
||||||
|
@ -77,7 +77,7 @@ def make_tts_request(
|
||||||
json={
|
json={
|
||||||
"model": "kokoro",
|
"model": "kokoro",
|
||||||
"input": text,
|
"input": text,
|
||||||
"voice": "af",
|
"voice": "af_heart",
|
||||||
"response_format": "wav",
|
"response_format": "wav",
|
||||||
"stream": False,
|
"stream": False,
|
||||||
},
|
},
|
||||||
|
|
|
@ -246,7 +246,7 @@ def main():
|
||||||
output_dir.mkdir(exist_ok=True, parents=True)
|
output_dir.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
# First generate audio in each format using the API
|
# First generate audio in each format using the API
|
||||||
voice = "af" # Using default voice
|
voice = "af_heart" # Using default voice
|
||||||
formats = ["wav", "mp3", "opus", "flac", "pcm"]
|
formats = ["wav", "mp3", "opus", "flac", "pcm"]
|
||||||
stats = []
|
stats = []
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ def test_format(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = client.audio.speech.create(
|
response = client.audio.speech.create(
|
||||||
model="tts-1", voice="af", input=text, response_format=format
|
model="tts-1", voice="af_heart", input=text, response_format=format
|
||||||
)
|
)
|
||||||
|
|
||||||
print("Got response, saving to file...")
|
print("Got response, saving to file...")
|
||||||
|
@ -43,7 +43,7 @@ def test_speed(speed: float):
|
||||||
try:
|
try:
|
||||||
response = client.audio.speech.create(
|
response = client.audio.speech.create(
|
||||||
model="tts-1",
|
model="tts-1",
|
||||||
voice="af",
|
voice="af_heart",
|
||||||
input="The quick brown fox jumped over the lazy dog.",
|
input="The quick brown fox jumped over the lazy dog.",
|
||||||
response_format="wav",
|
response_format="wav",
|
||||||
speed=speed,
|
speed=speed,
|
||||||
|
|
|
@ -16,7 +16,7 @@ async def mock_model_manager():
|
||||||
async def mock_voice_manager():
|
async def mock_voice_manager():
|
||||||
"""Mock voice manager for UI tests"""
|
"""Mock voice manager for UI tests"""
|
||||||
manager = AsyncMock()
|
manager = AsyncMock()
|
||||||
manager.list_voices = AsyncMock(return_value=["af", "bm_lewis", "af_sarah"])
|
manager.list_voices = AsyncMock(return_value=["af_heart", "bm_lewis", "af_sarah"])
|
||||||
return manager
|
return manager
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue