File size: 316 Bytes
5f3d8fc
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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}")