mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
25 lines
505 B
Python
25 lines
505 B
Python
import base64
|
|
import json
|
|
|
|
import requests
|
|
|
|
text = """奶酪芝士很浓郁!臭豆腐芝士有争议?陈年奶酪价格昂贵。"""
|
|
|
|
|
|
Type = "wav"
|
|
|
|
response = requests.post(
|
|
"http://localhost:8880/v1/audio/speech",
|
|
json={
|
|
"model": "kokoro",
|
|
"input": text,
|
|
"voice": "zf_xiaobei",
|
|
"speed": 1.0,
|
|
"response_format": Type,
|
|
"stream": False,
|
|
},
|
|
stream=True,
|
|
)
|
|
|
|
with open(f"outputnostreammoney.{Type}", "wb") as f:
|
|
f.write(response.content)
|