File size: 263 Bytes
07f1ef2
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
from transformers import pipeline


class EndpointHandler:
    def __init__(self, path=""):
        self.pipe = pipeline(model=path, trust_remote_code=True)

    def __call__(self, data):
        return self.pipe(data["inputs"], **(data.get("parameters") or {}))