from pathlib import Path
from openai import OpenAI
api_key = 'api_key_value'
client = OpenAI(
api_key = api_key
)
file_name = input('저장할 파일이름을 입력해주세요 : ')
file_path = Path(__file__).parent/f"{file_name}.mp3"
speech_file = open(file_path, 'rb')
response = client.audio.translations.create(
file = speech_file,
model = 'whisper-1',
)
print(response.text)