invincible-jha's picture
Upload 3 files
fea9f64 verified
raw
history blame contribute delete
475 Bytes
from functools import lru_cache
import hashlib
import json
class ModelCache:
def __init__(self, cache_size=128):
self.cache_size = cache_size
@lru_cache(maxsize=128)
def cache_result(self, input_key, result):
return result
def get_cache_key(self, audio_data):
# Create hash of audio data for cache key
return hashlib.md5(audio_data).hexdigest()
def clear_cache(self):
self.cache_result.cache_clear()