Text Classification
Transformers
Safetensors
Laya
English
system-one
calibrated-decisions
rlcd
typed-decisions
classification
agent-observability
invoice-processing
security-incidents
customer-service
commercial-use
Instructions to use binoykunhi/laya-typed-decisions-endpoint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use binoykunhi/laya-typed-decisions-endpoint with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="binoykunhi/laya-typed-decisions-endpoint")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("binoykunhi/laya-typed-decisions-endpoint", device_map="auto") - Laya
How to use binoykunhi/laya-typed-decisions-endpoint with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Create handler.py
Browse files- handler.py +23 -0
handler.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
os.environ.setdefault("USE_TF", "0")
|
| 4 |
+
|
| 5 |
+
import laya
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class EndpointHandler:
|
| 9 |
+
def __init__(self, path=""):
|
| 10 |
+
self.agent = laya.load(path)
|
| 11 |
+
|
| 12 |
+
def __call__(self, data):
|
| 13 |
+
payload = data.get("inputs", data)
|
| 14 |
+
|
| 15 |
+
state = payload.get("state")
|
| 16 |
+
questions = payload.get("questions")
|
| 17 |
+
|
| 18 |
+
if state is None or questions is None:
|
| 19 |
+
raise ValueError(
|
| 20 |
+
"Request must contain inputs.state and inputs.questions"
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
return self.agent.predict(state, questions)
|