hey_rehan / tts_module.py
muhammadnasar's picture
Upload 6 files
6cc9795 verified
raw
history blame contribute delete
No virus
306 Bytes
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