Spaces:
Sleeping
Sleeping
from openai import OpenAI | |
from dotenv import load_dotenv | |
import os | |
load_dotenv() | |
client = OpenAI(api_key=os.getenv("openai_api_key")) | |
def text_to_speech(text): | |
response = client.audio.speech.create( | |
model="tts-1", | |
voice="alloy", | |
input=text | |
) | |
return response.content | |