FunASRTranscriber
FunASRTranscriber
FunASR — 50개 이상 언어를 지원하는 로컬·오픈소스 음성 인식 툴킷 — 를 사용해 오디오 파일을 Haystack Document로 전사(transcribe)해요.
출처: 문서
본문
FunASRTranscriber는 Alibaba DAMO Academy의 오픈소스 음성 인식 툴킷인 FunASR을 사용해 오디오 파일을 Haystack Document 객체로 전사해요. 전적으로 로컬에서 실행되므로 API 키가 필요 없어요.
기본 모델은 iic/SenseVoiceSmall로, 50개 이상 언어를 지원하는 다국어 모델이며 Whisper보다 5~10배 빠르다고 해요. 모델은 첫 사용 시 ModelScope에서 다운로드되어 ~/.cache/modelscope에 캐시돼요.
이 컴포넌트는 오디오 파일 경로(str 또는 Path)와 ByteStream 객체를 모두 받아들여요. 모델은 컴포넌트가 처음 실행될 때 자동으로 메모리에 로드돼요.
- 대표적인 파이프라인 위치: 인덱싱 파이프라인의 첫 번째 컴포넌트
- 필수 run 변수:
sources— 오디오 파일 경로(str또는Path) 또는ByteStream객체 리스트 - 출력 변수:
documents— 소스당 하나씩, 전사 텍스트를content에 담은 HaystackDocument리스트 - API reference: FunASR integration
- GitHub link: transcriber.py
Usage
On its own
from haystack_integrations.components.audio.funasr import FunASRTranscriber
transcriber = FunASRTranscriber()
result = transcriber.run(sources=["speech.wav"])
print(result["documents"][0].content)
In a pipeline
from haystack import Pipeline
from haystack.components.fetchers import LinkContentFetcher
from haystack_integrations.components.audio.funasr import FunASRTranscriber
pipe = Pipeline()
pipe.add_component("fetcher", LinkContentFetcher())
pipe.add_component("transcriber", FunASRTranscriber())
pipe.connect("fetcher", "transcriber")
result = pipe.run(
data={
"fetcher": {
"urls": ["https://example.com/interview.wav"],
},
},
)
print(result["transcriber"]["documents"][0].content)
더 알아보기 (Learn more)
- FunASR integration API reference를 확인하세요.