Spaces:
Sleeping
Sleeping
Commit
·
3680556
1
Parent(s):
7b6b2a3
minor fixes
Browse files
model.py
CHANGED
|
@@ -15,6 +15,7 @@
|
|
| 15 |
# limitations under the License.
|
| 16 |
|
| 17 |
import wave
|
|
|
|
| 18 |
from typing import List, Tuple
|
| 19 |
|
| 20 |
import numpy as np
|
|
@@ -47,6 +48,7 @@ def read_wave(wave_filename: str) -> Tuple[np.ndarray, int]:
|
|
| 47 |
return samples_float32, f.getframerate()
|
| 48 |
|
| 49 |
|
|
|
|
| 50 |
def _get_nn_model_filename(
|
| 51 |
repo_id: str,
|
| 52 |
filename: str,
|
|
@@ -105,12 +107,14 @@ def get_speaker_diarization(
|
|
| 105 |
min_duration_on=0.3,
|
| 106 |
min_duration_off=0.5,
|
| 107 |
)
|
|
|
|
|
|
|
|
|
|
| 108 |
if not config.validate():
|
| 109 |
raise RuntimeError(
|
| 110 |
"Please check your config and make sure all required files exist"
|
| 111 |
)
|
| 112 |
|
| 113 |
-
print(config)
|
| 114 |
return sherpa_onnx.OfflineSpeakerDiarization(config)
|
| 115 |
|
| 116 |
|
|
|
|
| 15 |
# limitations under the License.
|
| 16 |
|
| 17 |
import wave
|
| 18 |
+
from functools import lru_cache
|
| 19 |
from typing import List, Tuple
|
| 20 |
|
| 21 |
import numpy as np
|
|
|
|
| 48 |
return samples_float32, f.getframerate()
|
| 49 |
|
| 50 |
|
| 51 |
+
@lru_cache(maxsize=30)
|
| 52 |
def _get_nn_model_filename(
|
| 53 |
repo_id: str,
|
| 54 |
filename: str,
|
|
|
|
| 107 |
min_duration_on=0.3,
|
| 108 |
min_duration_off=0.5,
|
| 109 |
)
|
| 110 |
+
|
| 111 |
+
print("config", config)
|
| 112 |
+
|
| 113 |
if not config.validate():
|
| 114 |
raise RuntimeError(
|
| 115 |
"Please check your config and make sure all required files exist"
|
| 116 |
)
|
| 117 |
|
|
|
|
| 118 |
return sherpa_onnx.OfflineSpeakerDiarization(config)
|
| 119 |
|
| 120 |
|