OmniVoice-Studio / generate_sample.py
Lê Phi Nam
Deploy to HF Space
94004a2
Raw
History Blame Contribute Delete
683 Bytes
import urllib.request
import json
url = "http://localhost:3900/v1/audio/speech"
data = {
"model": "omnivoice",
"input": "Xin chào! Đây là một đoạn âm thanh thử nghiệm được tạo ra tự động từ OmniVoice Studio. Chất lượng giọng đọc rất tự nhiên và hỗ trợ tiếng Việt rất tốt.",
"voice": "alloy",
"response_format": "wav"
}
req = urllib.request.Request(url, data=json.dumps(data).encode("utf-8"), headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req) as response:
with open("sample.wav", "wb") as f:
f.write(response.read())
print("Audio generated successfully at sample.wav")