mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
27 lines
654 B
Python
27 lines
654 B
Python
import base64
|
|
import json
|
|
|
|
import requests
|
|
|
|
text = """the administration has offered up a platter of repression for more than a year and is still slated to lose $400 million.
|
|
|
|
Columbia is the largest private landowner in New York City and boasts an endowment of $14.8 billion;"""
|
|
|
|
|
|
Type = "wav"
|
|
|
|
response = requests.post(
|
|
"http://localhost:8880/v1/audio/speech",
|
|
json={
|
|
"model": "kokoro",
|
|
"input": text,
|
|
"voice": "af_heart+af_sky",
|
|
"speed": 1.0,
|
|
"response_format": Type,
|
|
"stream": False,
|
|
},
|
|
stream=True,
|
|
)
|
|
|
|
with open(f"outputnostreammoney.{Type}", "wb") as f:
|
|
f.write(response.content)
|