Skip to main content

Audion Python SDK - 간편하게 음성 AI 기능을 통합하기 위한 Python 클라이언트 라이브러리

Project description

음성 AI 구현의 복잡함을 없애고, 비즈니스 가능성을 확장하세요.

License Python version

Audion Python SDK

Repository: https://github.com/holamago/audion-python-sdk

목차

특징

  • 간편한 음성 AI 통합: 몇 줄의 코드로 강력한 음성 AI 기능을 애플리케이션에 추가
  • 다양한 입력 지원: 로컬 파일 및 URL을 통한 음성/비디오 처리
  • 광범위한 파일 형식: 주요 오디오 및 비디오 형식 지원
  • 유연한 Flow 시스템: 다양한 음성 AI 워크플로우 지원
  • 간단한 API: 직관적이고 사용하기 쉬운 Python 인터페이스

요구사항

설치

pip을 사용하여 설치 (PyPI 패키지 이름: audionlib):

pip install audionlib

참고: 패키지 설치 이름은 audionlib이지만, 코드에서는 기존과 같이 from audion import AudionClient 형태로 import 합니다.

또는 requirements.txt에서 의존성과 함께 설치:

git clone https://github.com/holamago/audion-python-sdk.git
cd audion-python-sdk
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

의존성:

  • pydantic: 데이터 유효성 검사 및 설정 관리
  • requests: HTTP 요청 처리

스크립트를 이용한 개발 환경 설정

저장소를 클론한 경우, 제공된 스크립트로 쉽게 환경을 설정할 수 있습니다:

# 가상환경 생성, 의존성 설치 및 자동 활성화
./scripts/setup.sh

스크립트가 완료되면 가상환경이 자동으로 활성화된 새 셸이 시작됩니다.

환경 정리가 필요한 경우:

# 캐시 및 빌드 파일 정리
./scripts/clean.sh

빠른 시작

1. 클라이언트 초기화

from audion import AudionClient

# API 키로 클라이언트 초기화
client = AudionClient(api_key="your-api-key-here")

2. 로컬 파일 처리

  • 오디오/비디오 업로드
# 로컬 오디오/비디오 파일 처리
result = client.flow(
    flow="audion_vu",
    input_type="file",
    input="path/to/your/audio.wav"
)
print(result)

3. URL 처리

# YouTube URL 처리
result = client.flow(
    flow="audion_vu",
    input_type="url",
    input="<https://youtu.be/your-video-id>"
)
print(result)

API 문서

AudionClient

Audion 서비스의 메인 클라이언트 클래스입니다.

초기화

AudionClient(
    api_key: str,           # 필수: API 인증 키
    base_url: str = None,   # 선택: 서버 기본 URL
    timeout: float = 300    # 선택: 요청 타임아웃 (초)
)

매개변수:

  • api_key (str, 필수): Audion 서비스 인증을 위한 API 키
  • base_url (str, 선택): 서버의 기본 URL. 기본값은 프로덕션 서버
  • timeout (float, 선택): HTTP 요청 타임아웃. 기본값은 300초

예외:

  • ValueError: api_key가 제공되지 않은 경우

메서드

flow(flow, input_type, input)

지정된 플로우로 음성/비디오 처리를 실행합니다.

client.flow(
    flow: str,        # 실행할 플로우 이름
    input_type: str,  # 입력 타입: "file" 또는 "url"
    input: str        # 파일 경로 또는 URL
)

매개변수:

  • flow (str): 실행할 플로우의 이름
    • 현재 지원하는 플로우:
      • audion_vu: Voice Understanding
      • audion_vh: Voice Highlight
    • Custom Flow 지원 가능 (email:contact@holamago.com)
  • input_type (str): 입력 타입. "file" 또는 "url"
  • input (str): 처리할 파일의 경로 또는 URL

반환값:

  • dict: 처리 결과를 포함하는 JSON 응답

예외:

  • ValueError: 지원하지 않는 input_type인 경우
  • Exception: API 호출 실패 시

지원 파일 형식

오디오 형식

  • .wav - WAV (Waveform Audio File Format)
  • .mp3 - MP3 (MPEG-1 Audio Layer III)
  • .m4a - M4A (MPEG-4 Audio)
  • .ogg - OGG (Ogg Vorbis)
  • .flac - FLAC (Free Lossless Audio Codec)
  • .aac - AAC (Advanced Audio Coding)
  • .wma - WMA (Windows Media Audio)
  • .m4b, .m4p, .m4r, .m4v - 기타 MPEG-4 오디오 형식

비디오 형식

  • .mp4 - MP4 (MPEG-4 Part 14)
  • .mov - MOV (QuickTime File Format)
  • .avi - AVI (Audio Video Interleave)
  • .mkv - MKV (Matroska Video)
  • .webm - WebM
  • .wmv - WMV (Windows Media Video)
  • .flv - FLV (Flash Video)
  • .mpeg, .mpg - MPEG (Moving Picture Experts Group)

사용 예제

이 섹션은 examples/README.md의 내용을 포함하며, SDK를 실제로 어떻게 사용하는지 예제 중심으로 설명합니다.

사용 준비

1. API 키 설정

환경 변수로 API 키를 설정해주세요:

export AUDION_API_KEY='your-api-key-here'

또는 스크립트를 사용하여 실행:

AUDION_API_KEY='your-api-key-here' python examples/example_file.py

2. 가상환경 활성화

프로젝트 루트에서:

source venv/bin/activate

예제 목록

example_file.py

로컬 오디오/비디오 파일을 처리하는 예제입니다.

실행 방법:

python examples/example_file.py <file_path>

# 예시
python examples/example_file.py samples/audio.wav
python examples/example_file.py /path/to/video.mp4

example_url.py

YouTube 등의 URL을 처리하는 예제입니다.

실행 방법:

python examples/example_url.py <url>

# 예시
python examples/example_url.py https://youtu.be/abc123
python examples/example_url.py https://www.youtube.com/watch?v=abc123

빠른 예제 실행

# API 키 설정
export AUDION_API_KEY='your-api-key-here'

# 파일 처리
python examples/example_file.py samples/audio.wav

# URL 처리
python examples/example_url.py https://youtu.be/abc123

지원하는 Flow

  • audion_vu: Voice Understanding - 음성 인식 및 분석
  • audion_vh: Voice Highlight - 주요 음성 구간 추출
  • Custom Flow도 지원 가능합니다 (contact@holamago.com)

프로젝트 구조

audion-python-sdk/
├── README.md            # 메인 문서 (이 파일)
├── audion/              # 메인 패키지
│   ├── client.py        # AudionClient 클래스
│   ├── base.py          # 기본 클라이언트 구현
│   ├── config.py        # 설정
│   ├── core/            # 핵심 기능
│   └── helper/          # 유틸리티
├── examples/            # 사용 예제
│   ├── README.md
│   ├── example_file.py
│   └── example_url.py
├── scripts/             # 환경 설정 스크립트
│   ├── setup.sh
│   └── clean.sh
└── requirements.txt     # 의존성

문서

라이선스

이 프로젝트는 Apache License 2.0 하에 라이선스됩니다.

지원

버전 히스토리

  • v0.1.0: 초기 릴리스
    • 기본 flow API 지원
    • 파일 및 URL 입력 지원
    • 다중 오디오/비디오 형식 지원

Made with ❤️ by MAGO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audionlib-0.1.1.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

audionlib-0.1.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file audionlib-0.1.1.tar.gz.

File metadata

  • Download URL: audionlib-0.1.1.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for audionlib-0.1.1.tar.gz
Algorithm Hash digest
SHA256 724b490c876bccacf5dd8c719e692adc1d2608ebea143a4a48337b1dfb804b1b
MD5 13f4a76c906cbca9ba044d9015428bf4
BLAKE2b-256 7cd9d436d2f3bb33cd58b16edc132545b19713c2c3d08acab6f24c5953992877

See more details on using hashes here.

File details

Details for the file audionlib-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: audionlib-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for audionlib-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4acd8c79cb702f23ff1806e980d04f4bc24f62559b371470772a5514b698493c
MD5 10a65c34a5423eaa5d06bfcb9138cffc
BLAKE2b-256 a6a36e9559d14082eb682c079278f6bf70450cd1375256f3542e1150c6981964

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page