Speech-to-text

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 key की ज़रूरत नहीं—यह पहले से सेट है 🎉
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 के ऑडियो मॉडल

Speech-to-text क्षमताएँ:

  • ऑडियो ट्रांसक्राइब करें
  • नॉन-इंग्लिश ऑडियो ट्रांसलेट करें
  • 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 के साथ मल्टी-मॉडल सिस्टम

ट्रांसक्रिप्शन बनाना

  • ऑडियो endpoint
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...