Views
No views yet
[!WARNING] THIS PROJECT HAS BEEN ARCHIVED.This project and its associated code on GitHub are no longer under active development or maintained.
1from optimum.onnxruntime import ORTModelForSequenceClassification
2from transformers import AutoTokenizer, pipeline
3
4
5tokenizer = AutoTokenizer.from_pretrained("laiyer/distilroberta-bias-onnx")
6model = ORTModelForSequenceClassification.from_pretrained("laiyer/distilroberta-bias-onnx")
7classifier = pipeline(
8 task="text-classification",
9 model=model,
10 tokenizer=tokenizer,
11)
12
13classifier_output = classifier("Your text to analyze for bias.")
14score = (classifier_output[0]["score"] if classifier_output[0]["label"] == "BIASED" else 1 - classifier_output[0]["score"])