Spaces:
Sleeping
Sleeping
manue
commited on
Commit
·
1dc8930
1
Parent(s):
c39ca29
Refactor sentiment model initialization to simplify pipeline setup
Browse files- feel-it-italian-sentiment +1 -0
- model/sentiment.py +2 -4
feel-it-italian-sentiment
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit 98744f71b7b3a47ba00d57b2736c3af794c417ff
|
model/sentiment.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
-
from transformers import
|
2 |
from typing import Any
|
3 |
|
4 |
class Sentiment:
|
5 |
def __init__(self, line: str) -> (list | list[Any] | Any | None):
|
6 |
-
|
7 |
-
model = AutoModelForSequenceClassification.from_pretrained("MilaNLProc/feel-it-italian-sentiment")
|
8 |
-
self.pipe = pipeline("text-classification", model=model, tokenizer=tokenizer)
|
9 |
self.result = self.pipe(line)
|
10 |
|
|
|
1 |
+
from transformers import pipeline
|
2 |
from typing import Any
|
3 |
|
4 |
class Sentiment:
|
5 |
def __init__(self, line: str) -> (list | list[Any] | Any | None):
|
6 |
+
self.pipe = pipeline("text-classification", model='../feel-it-italian-sentiment')
|
|
|
|
|
7 |
self.result = self.pipe(line)
|
8 |
|