from functools import lru_cache | |
import hashlib | |
import json | |
class ModelCache: | |
def __init__(self, cache_size=128): | |
self.cache_size = cache_size | |
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() |