garrettbaber
commited on
Commit
·
1dbd2d4
1
Parent(s):
b9e53f7
Delete pipeline.py
Browse files- pipeline.py +0 -14
pipeline.py
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
from transformers import AutoModelForSequenceClassification, AutoTokenizer, Pipeline
|
2 |
-
|
3 |
-
class FearIntensityPipeline(Pipeline):
|
4 |
-
def __init__(self):
|
5 |
-
model = AutoModelForSequenceClassification.from_pretrained("garrettbaber/twitter-roberta-base-fear-intensity")
|
6 |
-
tokenizer = AutoTokenizer.from_pretrained("garrettbaber/twitter-roberta-base-fear-intensity")
|
7 |
-
super().__init__(model=model, tokenizer=tokenizer, task="text-classification")
|
8 |
-
|
9 |
-
def __call__(self, text):
|
10 |
-
inputs = self.tokenizer(text, return_tensors="pt", truncation=True)
|
11 |
-
outputs = self.model(**inputs)
|
12 |
-
score = outputs.logits.item()
|
13 |
-
result = {"score": score}
|
14 |
-
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|