pi-cnn-model / app /utils /model_loader.py
nbintang
fix: finaling the project to be clear
5f3d8fc
Raw
History Blame Contribute Delete
316 Bytes
import tensorflow as tf # type: ignore
from functools import lru_cache
from app.config import MODEL_PATH
@lru_cache(maxsize=2)
def load_model():
try:
model = tf.keras.models.load_model(MODEL_PATH)
return model
except Exception as e:
raise RuntimeError(f"❌ Gagal load model: {e}")