File size: 658 Bytes
b71808f 35575bb b71808f 19b3da3 fd5252e 19b3da3 1bc457e b71808f 19b3da3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(1, os.path.join(path, "external"))
from pathlib import Path
from typing import Any, Dict, List
from inference import model_fn, predict_fn
from internals.util.config import set_hf_cache_dir, set_model_config
from internals.util.model_loader import load_model_from_config
class EndpointHandler:
def __init__(self, path=""):
set_hf_cache_dir(Path.home() / ".cache" / "hf_cache")
self.model_dir = path
return model_fn(self.model_dir)
def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
return predict_fn(data, None)
|