MentalHealthVocalBiomarkers / model-cache.py
invincible-jha's picture
Upload 9 files
822dda9 verified
raw
history blame
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()