mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
Simple fixes and translations
This commit is contained in:
parent
70c0d506de
commit
3e6ee65482
4 changed files with 4 additions and 4 deletions
|
@ -145,7 +145,7 @@ Example usage with authentication:
|
||||||
# Using curl
|
# Using curl
|
||||||
curl -X POST "http://localhost:8880/v1/audio/speech" \
|
curl -X POST "http://localhost:8880/v1/audio/speech" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer sk-kokoro-your-api-key" \
|
-H "Authorization: Bearer sk-kokoro-your-api-key-1" \
|
||||||
-d '{"model":"kokoro", "input":"Hello world", "voice":"af_heart"}'
|
-d '{"model":"kokoro", "input":"Hello world", "voice":"af_heart"}'
|
||||||
|
|
||||||
# Using Python with OpenAI client
|
# Using Python with OpenAI client
|
||||||
|
|
|
@ -27,7 +27,7 @@ class AudioChunk:
|
||||||
if output.word_timestamps is not None:
|
if output.word_timestamps is not None:
|
||||||
output.word_timestamps+=audio_chunk.word_timestamps
|
output.word_timestamps+=audio_chunk.word_timestamps
|
||||||
|
|
||||||
# 从float32转换为int16,使用音频的方式
|
# Convert audio data from float32 to int16 format.
|
||||||
if output.audio.dtype == np.float32:
|
if output.audio.dtype == np.float32:
|
||||||
output.audio = (output.audio * 32767).astype(np.int16)
|
output.audio = (output.audio * 32767).astype(np.int16)
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,6 @@ class StreamingAudioWriter:
|
||||||
for packet in self.stream.encode(frame):
|
for packet in self.stream.encode(frame):
|
||||||
self.container.mux(packet)
|
self.container.mux(packet)
|
||||||
|
|
||||||
# 仅返回空字节,保持容器开放
|
# Only return a null byte and keep the container running.
|
||||||
return b""
|
return b""
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,4 @@ export WEB_PLAYER_PATH=$PROJECT_ROOT/web
|
||||||
|
|
||||||
# Run FastAPI with GPU extras using uv run
|
# Run FastAPI with GPU extras using uv run
|
||||||
uv pip install -e ".[gpu]"
|
uv pip install -e ".[gpu]"
|
||||||
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 50888
|
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 8880
|
||||||
|
|
Loading…
Add table
Reference in a new issue