Spaces:
Runtime error
Runtime error
File size: 438 Bytes
a75448e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import os
from openai import OpenAI
def audio_to_text(audio_data):
client = OpenAI()
transcription = client.audio.transcriptions.create(
model="whisper-1",
file=audio_data,
response_format="text"
)
return transcription
def text_to_speech(text):
client = OpenAI()
response = client.audio.speech.create(
model="tts-1",
voice="shimmer",
input=text
)
return response
|