Sumedh satish gajbhiye commited on
Commit
2598f76
·
verified ·
1 Parent(s): d4bc43a

Create handler.py

Browse files
Files changed (1) hide show
  1. handler.py +12 -0
handler.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import AutoTokenizer, pipeline
2
+ from optimum.onnxruntime import ORTModelForSequenceClassification
3
+
4
+ model_id = "."
5
+
6
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
7
+ model = ORTModelForSequenceClassification.from_pretrained(model_id)
8
+
9
+ classifier = pipeline("text-classification", model=model, tokenizer=tokenizer)
10
+
11
+ def __call__(data):
12
+ return classifier(data["inputs"])