음성 → 텍스트

OpenAI API로 만드는 멀티모달 시스템

James Chapman

Curriculum Manager, DataCamp

이어지는 내용...

$$

강의 목표
  • OpenAI 오디오 모델
  • 텍스트 모더레이션
  • 사례 연구: 고객 지원 챗봇

오디오 모델, 텍스트 모더레이션, 사례 연구 이미지

OpenAI API로 만드는 멀티모달 시스템

요약...

from openai import OpenAI


# Create the OpenAI client client = OpenAI(api_key="<OPENAI_API_TOKEN>")
# Create a request to the Chat Completions endpoint response = client.chat.completions.create(
model="gpt-4o-mini", messages=[{"role": "user", "content": "What is the OpenAI API?"}]
)
  • API 키 불필요—이미 설정되어 있습니다 🎉
OpenAI API로 만드는 멀티모달 시스템

요약...

# Extract the content from the response
print(response.choices[0].message.content)
The OpenAI API is a cloud-based service provided by OpenAI that allows developers
to integrate advanced AI models into their applications.

$$

  • OpenAI API는 텍스트를 넘어섭니다 🚀
OpenAI API로 만드는 멀티모달 시스템

OpenAI의 오디오 모델

음성 → 텍스트 기능:

  • 오디오 전사
  • 비영어 오디오 번역
  • mp3, mp4, mpeg, mpga, m4a, wav, webm 지원 (25 MB 제한)

 

활용 사례:

  • 회의 전사
  • 동영상 자막

오디오 녹음 아이콘과 텍스트 블록.

  • 고객 통화 처리
OpenAI API로 만드는 멀티모달 시스템

오디오 파일 불러오기

 

예시: meeting_recording.mp3 전사

audio_file = open("meeting_recording.mp3", "rb")

$$

파일이 다른 디렉터리에 있을 때

audio_file = open("path/to/file/meeting_recording.mp3", "rb")
OpenAI API로 만드는 멀티모달 시스템

전사 생성하기

  • 오디오 엔드포인트
audio_file= open("meeting_recording.mp3", "rb")

response = client.audio.transcriptions.create(
model="whisper-1",
file=audio_file
)
print(response)
Transcription(text="Welcome everyone to the June product monthly. We'll get started in...)
1 https://platform.openai.com/docs/guides/speech-to-text
OpenAI API로 만드는 멀티모달 시스템

전사 결과

print(response.text)
Welcome everyone to the June product monthly. We'll get started in just a minute.
Alright, let's get started. Today's agenda will start with a spotlight from Chris
on the new mobile user onboarding flow, then we'll review how we're tracking on
our quarterly targets, and finally, we'll finish with another spotlight from Katie
who will discuss the upcoming branding updates...
OpenAI API로 만드는 멀티모달 시스템

비영어 오디오 전사

오디오 녹음 아이콘과 텍스트 블록.

전사 워크플로:

  1. open()으로 오디오 열기
  2. 전사 요청 보내기
  3. 텍스트 추출
OpenAI API로 만드는 멀티모달 시스템

번역 생성하기

audio_file = open("non_english_audio.m4a", "rb")


response = client.audio.translations.create(
model="whisper-1",
file=audio_file
)
print(response.text)
The search volume for keywords like A I has increased rapidly since the launch of
Cha GTP.
OpenAI API로 만드는 멀티모달 시스템

전사 성능

 

  • 성능은 다음에 따라 크게 달라질 수 있습니다:
    • 오디오 품질
    • 오디오 언어
    • 모델의 주제 지식

전 세계 다양한 언어.

OpenAI API로 만드는 멀티모달 시스템

연습해 봅시다!

OpenAI API로 만드는 멀티모달 시스템

Preparing Video For Download...