VggishAudioEncoder is a class that wraps the VGGISH model for generating embeddings for audio data.
Table of Contents
Run the provided bash script download_model.sh
to download the pretrained model.
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'
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'
-
Install the
jinahub-VGGishAudioEncoder
package.pip install git+https://github.com/jina-ai/executor-audio-VGGishEncoder.git
-
Use
jinahub-MY-DUMMY-EXECUTOR
in your codefrom jina import Flow from jinahub.SUB_PACKAGE_NAME.MODULE_NAME import VggishAudioEncoder f = Flow().add(uses=VggishAudioEncoder)
-
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 .
-
Use
my-dummy-executor-image
in your codesfrom jina import Flow f = Flow().add(uses='docker://executor-audio-vggish-encoder-image:latest')
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}')
Document
with blob
of containing loaded audio.
Document
with embedding
fields filled with an ndarray
of the shape embedding_dim
with dtype=nfloat32
.