logo
Browse Source

Update

Signed-off-by: Jael Gu <mengjia.gu@zilliz.com>
main
Jael Gu 3 years ago
parent
commit
531fcae57b
  1. 2
      README.md
  2. 3
      vggish.py

2
README.md

@ -21,7 +21,7 @@ audio_encoder = ops.audio_embedding.vggish()
audio_embedding = audio_encoder("/audio/path/or/url/")
# Audio data as input
audio_data = np.zeros((441344, 2))
audio_data = np.zeros((2, 441344))
sample_rate = 44100
audio_embedding = audio_encoder(audio_data, sample_rate)
```

3
vggish.py

@ -62,6 +62,7 @@ class Vggish(NNOperator):
audio_tensors = vggish_input.wavfile_to_examples(audio)
elif isinstance(audio, numpy.ndarray):
try:
audio = audio.transpose()
audio_tensors = vggish_input.waveform_to_examples(audio, sr, return_tensor=True)
except Exception as e:
log.error("Fail to load audio data.")
@ -77,7 +78,7 @@ class Vggish(NNOperator):
# # audio_path = '/path/to/audio'
# # vec = encoder(audio_path)
#
# audio_data = numpy.zeros((441344, 2))
# audio_data = numpy.zeros((2, 441344))
# sample_rate = 44100
# vec = encoder(audio_data, sample_rate)
# print(vec)

Loading…
Cancel
Save