Download handler.py from yxnxc/laya-claim-detection: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/yxnxc/laya-claim-detection/resolve/main/handler.py
- Command line
-
hf download hf://yxnxc/laya-claim-detection/handler.py
-
curl -L -o handler.py https://huggingface.co/yxnxc/laya-claim-detection/resolve/main/handler.py
607 Bytes
| import laya | |
| class EndpointHandler: | |
| def __init__(self, path=""): | |
| self.agent = laya.Agent(path, device="cuda") | |
| def __call__(self, data): | |
| inputs = data.pop("inputs", data) | |
| questions = { | |
| "is_claim": { | |
| "type": "noul", | |
| "instructions": "Does this text contain a verifiable factual claim?", | |
| } | |
| } | |
| if isinstance(inputs, list): | |
| results = [self.agent.predict(text, questions) for text in inputs] | |
| return results | |
| return self.agent.predict(inputs, questions) |