Spaces:
Runtime error
Runtime error
[email protected]
commited on
Commit
·
10d9e34
1
Parent(s):
a00e24a
more broken virtualenvs
Browse files
language-models-project/language_models_project/main.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
3 |
+
|
4 |
+
def classify():
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("finiteautomata/bertweet-base-sentiment-analysis")
|
6 |
+
model = AutoModelForSequenceClassification.from_pretrained("finiteautomata/bertweet-base-sentiment-analysis")
|
7 |
+
sentiment_pipeline = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
8 |
+
return sentiment_pipeline
|
language-models-project/tests/test_classifier.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from language_models_project.main import classify
|
2 |
+
|
3 |
+
def testclassifier():
|
4 |
+
""" Tests that the classifier classifies as expected """
|
5 |
+
test_cases = ["This restaurant is awesome", "This restaurant is awful"]
|
6 |
+
|