✨ VggishAudioEncoder

VggishAudioEncoder is a class that wraps the VGGISH model for generating embeddings for audio data.

Table of Contents

🌱 Prerequisites

Run the provided bash script download_model.sh to download the pretrained model.

🚀 Usages

🚚 Via JinaHub

using docker images

Use the prebuilt images from JinaHub in your python codes,

from jina import Flow
	
f = Flow().add(uses='jinahub+docker://VGGishAudioEncoder')

or in the .yml config.

jtype: Flow
pods:
  - name: encoder
    uses: 'jinahub+docker://VGGishAudioEncoder'

using source codes

Use the source codes from JinaHub in your python codes,

from jina import Flow
	
f = Flow().add(uses='jinahub://VGGishAudioEncoder')

or in the .yml config.

jtype: Flow
pods:
  - name: encoder
    uses: 'jinahub://VGGishAudioEncoder'

📦️ Via Pypi

  1. Install the jinahub-VGGishAudioEncoder package.

    pip install git+https://github.com/jina-ai/executor-audio-VGGishEncoder.git
  2. Use jinahub-MY-DUMMY-EXECUTOR in your code

    from jina import Flow
    from jinahub.SUB_PACKAGE_NAME.MODULE_NAME import VggishAudioEncoder
    
    f = Flow().add(uses=VggishAudioEncoder)

🐳 Via Docker

  1. Clone the repo and build the docker image

    git clone https://github.com/jina-ai/executor-audio-VggishAudioEncoder.git
    cd executor-audio-VGGishEncoder
    docker build -t executor-audio-vggish-encoder-image .
  2. Use my-dummy-executor-image in your codes

    from jina import Flow
    
    f = Flow().add(uses='docker://executor-audio-vggish-encoder-image:latest')

🎉️ Example

from jina import Flow, Document

f = Flow().add(uses='jinahub+docker://VggishAudioEncoder')

with f:
    resp = f.post(on='foo', inputs=Document(), return_resutls=True)
	print(f'{resp}')

Inputs

Document with blob of containing loaded audio.

Returns

Document with embedding fields filled with an ndarray of the shape embedding_dim with dtype=nfloat32.

🔍️ Reference