Chirp 2: 다국어 지원 정확성 향상

Chirp 2는 피드백과 경험을 기반으로 사용자 요구사항을 충족하도록 설계된 최신 세대의 Google 다국어 ASR 전용 모델입니다. 정확성과 속도에서 원래 Chirp 모델을 개선하고 단어 수준 타임스탬프, 모델 적응, 음성 번역과 같은 주요 새 기능으로 확장합니다.

Colab 노트북 사용해 보기 GitHub에서 노트북 보기

모델 세부정보

Chirp 2는 Speech-to-Text API V2에서만 사용할 수 있습니다.

모델 식별자

Google Cloud 콘솔에서 API 또는 모델 이름을 사용할 때 인식 요청에 적절한 모델 식별자를 지정하여 Chirp 2를 다른 모델과 동일하게 사용할 수 있습니다.

모델 모델 식별자
Chirp 2 chirp_2

API 메서드

Chirp 2는 Speech-to-Text API V2에서만 사용할 수 있으므로 다음 인식 방법을 지원합니다.

모델 모델 식별자 언어 지원
V2 Speech.StreamingRecognize(스트리밍 및 실시간 오디오에 적합) 제한됨*
V2 Speech.Recognize(1분 미만의 짧은 오디오에 적합) Chirp와 동일
V2 Speech.BatchRecognize(1분~8시간의 긴 오디오에 적합) Chirp와 동일

*Location API를 사용하여 언제든지 각 스크립트 작성 모델에 지원되는 언어 및 기능의 최신 목록을 확인할 수 있습니다.

사용 가능한 리전

Chirp 2는 다음 리전에서 지원됩니다.

Google Cloud 영역 출시 준비
us-central1 GA
europe-west4 GA
asia-southeast1 GA

여기에 설명된 대로 Location API를 사용하여 언제든지 각 스크립트 작성 모델에 대해 지원되는 Google Cloud 리전, 언어 및 기능의 최신 목록을 확인할 수 있습니다.

스크립트 작성 지원 언어

Chirp 2는 StreamingRecognize, Recognize, BatchRecognize 인식 방법의 스크립트 작성을 지원합니다. 하지만 언어 지원은 사용된 방법에 따라 다릅니다. 특히 BatchRecognize는 가장 광범위한 언어 지원을 제공합니다. StreamingRecognize은 다음 언어를 지원합니다.

언어 BCP-47 코드
중국어 간체(중국) cmn-Hans-CN
중국어(번체, 타이완) cmn-Hant-TW
중국어, 광둥어(번체 홍콩) yue-Hant-HK
영어(호주) en-AU
영어(인도) en-IN
영어(영국) en-GB
영어(미국) en-US
프랑스어(캐나다) fr-CA
프랑스어(프랑스) fr-FR
독일어(독일) de-DE
이탈리아어(이탈리아) it-IT
일본어(일본) ja-JP
한국어(대한민국) ko-KR
포르투갈어(브라질) pt-BR
스페인어(스페인) es-ES
스페인어(미국) es-US

번역 지원 언어

음성 번역에 지원되는 언어는 다음과 같습니다. Chirp 2의 번역 언어 지원은 대칭적이지 않습니다. 즉, 언어 A에서 언어 B로 번역할 수 있지만 언어 B에서 언어 A로 번역하지 못할 수도 있습니다. 음성 번역에 지원되는 언어 쌍은 다음과 같습니다.

영어로 번역:

소스 -> 도착어 소스 -> 도착어 코드
아랍어(이집트) -> 영어 ar-EG -> en-US
아랍어(걸프) -> 영어 ar-x-gulf -> en-US
아랍어(레반트) > 영어 ar-x-levant -> en-US
아랍어(마그레브) -> 영어 ar-x-maghrebi -> en-US
카탈로니아어(스페인) -> 영어 ca-ES -> en-US
웨일스어(영국) -> 영어 cy-GB -> en-US
독일어(독일) -> 영어 de-DE -> en-US
스페인어(라틴 아메리카) -> 영어 es-419 -> en-US
스페인어(스페인) -> 영어 es-ES -> en-US
스페인어(미국) -> 영어 es-US -> en-US
에스토니아어(에스토니아) -> 영어 et-EE -> en-US
프랑스어(캐나다) -> 영어 fr-CA -> en-US
프랑스어(프랑스) -> 영어 fr-FR -> en-US
페르시아어(이란) -> 영어 fa-IR -> en-US
인도네시아어(인도네시아) -> 영어 id-ID -> en-US
이탈리아어(이탈리아) -> 영어 it-IT -> en-US
일본어(일본) -> 영어 ja-JP -> en-US
라트비아어(라트비아) -> 영어 lv-LV -> en-US
몽골어(몽골) -> 영어 mn-MN -> en-US
네덜란드어(네덜란드) -> 영어 nl-NL -> en-US
포르투갈어(브라질) -> 영어 pt-BR -> en-US
러시아어(러시아) -> 영어 ru-RU -> en-US
슬로베니아어(슬로베니아) -> 영어 sl-SI -> en-US
스웨덴어(스웨덴) -> 영어 sv-SE -> en-US
타밀어(인도) -> 영어 ta-IN -> en-US
튀르키예어(튀르키예) -> 영어 tr-TR -> en-US
중국어(간체, 중국) -> 영어 cmn-Hans-CN -> en-US

영어에서 번역:

소스 -> 도착어 소스 -> 도착어 코드
영어 -> 아랍어(이집트) en-US -> ar-EG
영어 -> 아랍어(걸프) en-US -> ar-x-gulf
영어 -> 아랍어(레반트) en-US -> ar-x-levant
영어 -> 아랍어(마그레브) en-US -> ar-x-maghrebi
영어 -> 카탈루냐어(스페인) en-US -> ca-ES
영어 -> 웨일스어(영국) en-US -> cy-GB
영어 -> 독일어(독일) en-US -> de-DE
영어 -> 에스토니아어(에스토니아) en-US -> et-EE
영어 -> 페르시아어(이란) en-US -> fa-IR
영어 -> 인도네시아어(인도네시아) en-US -> id-ID
영어 -> 일본어(일본) en-US -> ja-JP
영어 -> 라트비아어(라트비아) en-US -> lv-LV
영어 -> 몽골어(몽골) en-US -> mn-MN
영어 -> 슬로베니아어(슬로베니아) en-US -> sl-SI
영어 -> 스웨덴어(스웨덴) en-US -> sv-SE
영어 -> 타밀어(인도) en-US -> ta-IN
영어 -> 튀르키예어(튀르키예) en-US -> tr-TR
영어 -> 중국어(간체, 중국) en-US -> cmn-Hans-CN

기능 지원 및 제한사항

Chirp 2는 다음 기능을 지원합니다.

기능 설명
자동 구두점 모델에 의해 자동으로 생성되며 원하는 경우 사용 중지할 수 있습니다.
자동 대문자 사용 모델에 의해 자동으로 생성되며 원하는 경우 사용 중지할 수 있습니다.
음성 적응(편향) 특정 용어 또는 고유명사의 인식 정확도를 높이기 위해 간단한 단어 또는 문구 형식으로 모델에 힌트를 제공합니다. 클래스 토큰 또는 커스텀 클래스는 지원되지 않습니다.
단어 시간(타임스탬프) 모델에 의해 자동으로 생성되며 원하는 경우 사용 설정할 수 있습니다. 스크립트 품질과 속도가 약간 저하될 수 있습니다.
욕설 필터 비속어를 감지하고 스크립트에 첫 번째 문자와 별표만 반환합니다(예: f***).
언어 제약이 없는 오디오 스크립트 작성 모델은 오디오 파일에서 음성 언어를 자동으로 추론하여 가장 흔한 언어로 스크립트를 작성합니다.
언어별 번역 모델은 음성 언어를 도착어로 자동 번역합니다.
강제 정규화 요청 본문에 정의된 경우 API는 특정 용어 또는 구문에 대해 문자열을 대체하여 스크립트 작성의 일관성을 보장합니다.
단어 수준의 신뢰도 점수 API는 값을 반환하지만 실제 신뢰도 점수는 아닙니다. 번역의 경우 신뢰도 점수가 반환되지 않습니다.
잡음 제거 및 SNR 필터링 모델에 전송하기 전에 오디오에서 잡음을 제거합니다. SNR이 지정된 기준점보다 낮은 경우 오디오 세그먼트를 필터링합니다.

Chirp 2는 다음 기능을 지원하지 않습니다.

기능 설명
분할 지원되지 않음
언어 감지 지원되지 않음

Chirp 2를 사용하여 스크립트 작성

스크립트 작성 및 번역에 Chirp 2를 사용하는 방법을 알아보세요.

스트리밍 음성 인식 수행

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_streaming_chirp2(
    audio_file: str
) -> cloud_speech.StreamingRecognizeResponse:
    """Transcribes audio from audio file stream using the Chirp 2 model of Google Cloud Speech-to-Text V2 API.

    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"

    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API V2 containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        content = f.read()

    # In practice, stream should be a generator yielding chunks of audio data
    chunk_length = len(content) // 5
    stream = [
        content[start : start + chunk_length]
        for start in range(0, len(content), chunk_length)
    ]
    audio_requests = (
        cloud_speech.StreamingRecognizeRequest(audio=audio) for audio in stream
    )

    recognition_config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
    )
    streaming_config = cloud_speech.StreamingRecognitionConfig(
        config=recognition_config
    )
    config_request = cloud_speech.StreamingRecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        streaming_config=streaming_config,
    )

    def requests(config: cloud_speech.RecognitionConfig, audio: list) -> list:
        yield config
        yield from audio

    # Transcribes the audio into text
    responses_iterator = client.streaming_recognize(
        requests=requests(config_request, audio_requests)
    )
    responses = []
    for response in responses_iterator:
        responses.append(response)
        for result in response.results:
            print(f"Transcript: {result.alternatives[0].transcript}")

    return responses

동기 음성 인식 수행

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_sync_chirp2(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Transcribes an audio file using the Chirp 2 model of Google Cloud Speech-to-Text V2 API.
    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Transcript: {result.alternatives[0].transcript}")

    return response

일괄 음성 인식 수행

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_batch_chirp2(
    audio_uri: str,
) -> cloud_speech.BatchRecognizeResults:
    """Transcribes an audio file from a Google Cloud Storage URI using the Chirp 2 model of Google Cloud Speech-to-Text V2 API.
    Args:
        audio_uri (str): The Google Cloud Storage URI of the input audio file.
            E.g., gs://[BUCKET]/[FILE]
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
    )

    file_metadata = cloud_speech.BatchRecognizeFileMetadata(uri=audio_uri)

    request = cloud_speech.BatchRecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        files=[file_metadata],
        recognition_output_config=cloud_speech.RecognitionOutputConfig(
            inline_response_config=cloud_speech.InlineOutputConfig(),
        ),
    )

    # Transcribes the audio into text
    operation = client.batch_recognize(request=request)

    print("Waiting for operation to complete...")
    response = operation.result(timeout=120)

    for result in response.results[audio_uri].transcript.results:
        print(f"Transcript: {result.alternatives[0].transcript}")

    return response.results[audio_uri].transcript

Chirp 2 기능 사용

코드 예시를 통해 최신 기능을 사용하는 방법을 알아보세요.

언어 제약이 없는 스크립트 작성 수행

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_sync_chirp2_auto_detect_language(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Transcribes an audio file and auto-detect spoken language using Chirp 2.
    Please see https://cloud.google.com/speech-to-text/v2/docs/encoding for more
    information on which audio encodings are supported.
    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """
    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["auto"],  # Set language code to auto to detect language.
        model="chirp_2",
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Transcript: {result.alternatives[0].transcript}")
        print(f"Detected Language: {result.language_code}")

    return response

음성 번역 수행

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def translate_sync_chirp2(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Translates an audio file using Chirp 2.
    Args:
        audio_file (str): Path to the local audio file to be translated.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the translated results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["fr-FR"],  # Set language code to targeted to detect language.
        translation_config=cloud_speech.TranslationConfig(target_language="fr-FR"), # Set target language code.
        model="chirp_2",
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Translated transcript: {result.alternatives[0].transcript}")

    return response

단어 수준 타임스탬프 사용 설정

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_sync_chirp2_with_timestamps(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Transcribes an audio file using the Chirp 2 model of Google Cloud Speech-to-Text V2 API, providing word-level timestamps for each transcribed word.
    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
        features=cloud_speech.RecognitionFeatures(
            enable_word_time_offsets=True, # Enabling word-level timestamps
        )
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Transcript: {result.alternatives[0].transcript}")

    return response

모델 적응으로 정확도 개선

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_sync_chirp2_model_adaptation(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Transcribes an audio file using the Chirp 2 model with adaptation, improving accuracy for specific audio characteristics or vocabulary.
    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
        # Use model adaptation
        adaptation=cloud_speech.SpeechAdaptation(
          phrase_sets=[
              cloud_speech.SpeechAdaptation.AdaptationPhraseSet(
                  inline_phrase_set=cloud_speech.PhraseSet(phrases=[
                    {
                        "value": "alphabet",
                    },
                    {
                          "value": "cell phone service",
                    }
                  ])
              )
          ]
        )
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Transcript: {result.alternatives[0].transcript}")

    return response

잡음 제거 및 SNR 필터링 세부정보

denoiser_audio=true는 배경 음악이나 빗소리, 거리 교통 소음과 같은 소음을 효과적으로 줄이는 데 도움이 됩니다. 잡음 제거는 배경에 있는 사람의 목소리는 제거할 수 없습니다.

snr_threshold=X를 설정하여 스크립트 작성을 위해 필요한 음성의 최소 음량을 제어할 수 있습니다. 이렇게 하면 음성이 아닌 오디오나 배경 소음을 필터링하여 결과에 원치 않는 텍스트가 표시되지 않도록 할 수 있습니다. snr_threshold가 높을수록 모델이 발화를 스크립트로 작성하려면 사용자가 더 크게 말해야 합니다.

SNR 필터링은 실시간 스트리밍 사용 사례에서 불필요한 소리를 스크립트 작성 모델에 전송하지 않도록 하는 데 사용할 수 있습니다. 이 설정의 값이 높을수록 스크립트 작성 모델로 전송되는 음성 볼륨이 배경 소음에 비해 더 커야 합니다.

snr_threshold 구성은 denoise_audiotrue인지 false인지와 상호작용합니다. denoise_audio=true를 사용하면 배경 소음이 제거되고 음성이 비교적 선명해집니다. 오디오의 전체 SNR이 올라갑니다.

사용 사례에 다른 사람이 말하지 않고 사용자의 음성만 포함되는 경우 denoise_audio=true를 설정하여 SNR 필터링의 감도를 높여 음성이 아닌 소음을 필터링할 수 있습니다. 사용 사례에 배경에서 말하는 사람이 포함되어 있고 배경 음성을 스크립트 작성하지 않으려면 denoise_audio=false를 설정하고 SNR 기준점을 낮추는 것이 좋습니다.

다음은 권장되는 SNR 기준점 값입니다. 적절한 snr_threshold 값은 0~1000에서 설정할 수 있습니다. 0 값은 아무것도 필터링하지 않음을 의미하고 1000 값은 모든 것을 필터링함을 의미합니다. 권장 설정이 작동하지 않으면 값을 미세 조정하세요.

잡음 제거 SNR 기준점 음성 민감도
10.0 높음
20.0 중간
40.0 낮음
100.0 매우 낮음
거짓 0.5 높음
거짓 1.0 중간
거짓 2.0 낮음
거짓 5.0 매우 낮음

잡음 제거 및 SNR 필터링 사용 설정

import os

from google.cloud.speech_v2 import SpeechClient
from google.cloud.speech_v2.types import cloud_speech
from google.api_core.client_options import ClientOptions

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")

def transcribe_sync_chirp2_with_timestamps(
    audio_file: str
) -> cloud_speech.RecognizeResponse:
    """Transcribes an audio file using the Chirp 2 model of Google Cloud Speech-to-Text V2 API, providing word-level timestamps for each transcribed word.
    Args:
        audio_file (str): Path to the local audio file to be transcribed.
            Example: "resources/audio.wav"
    Returns:
        cloud_speech.RecognizeResponse: The response from the Speech-to-Text API containing
        the transcription results.
    """

    # Instantiates a client
    client = SpeechClient(
        client_options=ClientOptions(
            api_endpoint="us-central1-speech.googleapis.com",
        )
    )

    # Reads a file as bytes
    with open(audio_file, "rb") as f:
        audio_content = f.read()

    config = cloud_speech.RecognitionConfig(
        auto_decoding_config=cloud_speech.AutoDetectDecodingConfig(),
        language_codes=["en-US"],
        model="chirp_2",
        denoiser_config={
            denoise_audio: True,
            # Medium snr threshold
            snr_threshold: 20.0,
        }
    )

    request = cloud_speech.RecognizeRequest(
        recognizer=f"projects/{PROJECT_ID}/locations/us-central1/recognizers/_",
        config=config,
        content=audio_content,
    )

    # Transcribes the audio into text
    response = client.recognize(request=request)

    for result in response.results:
        print(f"Transcript: {result.alternatives[0].transcript}")

    return response

Google Cloud 콘솔에서 Chirp 2 사용

  1. Google Cloud 계정에 가입하고 프로젝트를 만듭니다.
  2. Google Cloud 콘솔에서 음성으로 이동합니다.
  3. API가 사용 설정되지 않은 경우 API를 사용 설정합니다.
  4. STT 콘솔 작업공간이 있는지 확인합니다. 작업공간이 없으면 작업공간을 만들어야 합니다.

    1. 스크립트 작성 페이지로 이동하여 새 스크립트 작성을 클릭합니다.

    2. 작업공간 드롭다운을 열고 새 작업공간을 클릭하여 스크립트 작성용 작업공간을 만듭니다.

    3. 새 작업공간 만들기 탐색 사이드바에서 찾아보기를 클릭합니다.

    4. 클릭하여 새 버킷을 만듭니다.

    5. 버킷 이름을 입력하고 계속을 클릭합니다.

    6. 만들기를 클릭하여 Cloud Storage 버킷을 만듭니다.

    7. 버킷을 만든 후 선택을 클릭하여 사용할 버킷을 선택합니다.

    8. 만들기를 클릭하여 Speech-to-Text API V2 콘솔의 작업공간 만들기를 완료합니다.

  5. 실제 오디오에서 텍스트 변환을 수행합니다.

    파일 선택 또는 업로드를 보여주는 Speech-to-Text 텍스트 변환 만들기 페이지의 스크린샷입니다.

    새 텍스트 변환 페이지에서 업로드(로컬 업로드) 또는 기존 Cloud Storage 파일(Cloud Storage)을 지정하여 오디오 파일을 선택합니다.

  6. 계속을 클릭하여 스크립트 작성 옵션으로 이동합니다.

    1. 이전에 만든 인식기에서 Chirp의 인식에 사용할 음성 언어를 선택합니다.

    2. 모델 드롭다운에서 chirp_2를 선택합니다.

    3. 인식기 드롭다운에서 새로 만든 인식기를 선택합니다.

    4. chirp_2를 사용하여 첫 번째 인식 요청을 실행하려면 제출을 클릭합니다.

  7. Chirp 2 스크립트 작성 결과를 확인합니다.

    1. 스크립트 작성 페이지에서 스크립트 작성 이름을 클릭하여 결과를 확인합니다.

    2. 스크립트 작성 세부정보 페이지에서 스크립트 작성 결과를 확인하고 원하는 경우 브라우저에서 오디오를 재생합니다.

삭제

이 페이지에서 사용한 리소스 비용이 Google Cloud 계정에 청구되지 않도록 하려면 다음 단계를 수행합니다.

  1. Optional: Revoke the authentication credentials that you created, and delete the local credential file.

    gcloud auth application-default revoke
  2. Optional: Revoke credentials from the gcloud CLI.

    gcloud auth revoke

콘솔

  • In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  • In the project list, select the project that you want to delete, and then click Delete.
  • In the dialog, type the project ID, and then click Shut down to delete the project.
  • gcloud

  • In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  • In the project list, select the project that you want to delete, and then click Delete.
  • In the dialog, type the project ID, and then click Shut down to delete the project.
  • 다음 단계