15 lines
347 B
Python
15 lines
347 B
Python
from openai import OpenAI
|
|
import pathlib
|
|
|
|
client = OpenAI()
|
|
|
|
texto = open("tema1.md", "r", encoding="utf-8").read()
|
|
print("hola")
|
|
speech_file = pathlib.Path("tema1.mp3")
|
|
|
|
with client.audio.speech.with_streaming_response.create(
|
|
model="gpt-4o-mini-tts",
|
|
voice="alloy",
|
|
input=texto
|
|
) as response:
|
|
response.stream_to_file(speech_file) |