Spaces:
Runtime error
Runtime error
Commit
Β·
4d71280
1
Parent(s):
c3277a4
Code
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from huggingface_hub import hf_hub_download
|
|
| 3 |
from audio_index import AudioEmbeddingSystem
|
| 4 |
from search import search
|
| 5 |
import pandas as pd
|
|
|
|
| 6 |
|
| 7 |
db_file = hf_hub_download(
|
| 8 |
repo_id="freddyaboulton/common-voice-english-audio",
|
|
@@ -21,6 +22,8 @@ audio_embedding_system = AudioEmbeddingSystem(db_path=db_file, index_path=index_
|
|
| 21 |
def audio_search(audio_tuple):
|
| 22 |
sample_rate, array = audio_tuple
|
| 23 |
array = array[: int(sample_rate * 10)]
|
|
|
|
|
|
|
| 24 |
rows = audio_embedding_system.search((sample_rate, array))
|
| 25 |
orig_rows = search(rows)
|
| 26 |
for row in rows:
|
|
|
|
| 3 |
from audio_index import AudioEmbeddingSystem
|
| 4 |
from search import search
|
| 5 |
import pandas as pd
|
| 6 |
+
import numpy as np
|
| 7 |
|
| 8 |
db_file = hf_hub_download(
|
| 9 |
repo_id="freddyaboulton/common-voice-english-audio",
|
|
|
|
| 22 |
def audio_search(audio_tuple):
|
| 23 |
sample_rate, array = audio_tuple
|
| 24 |
array = array[: int(sample_rate * 10)]
|
| 25 |
+
array = array.astype(np.float32) / 32768.0
|
| 26 |
+
|
| 27 |
rows = audio_embedding_system.search((sample_rate, array))
|
| 28 |
orig_rows = search(rows)
|
| 29 |
for row in rows:
|