Spaces:
Runtime error
Runtime error
ombhagwat24
commited on
Commit
•
1455a51
1
Parent(s):
00f1c26
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import torch
|
3 |
+
import torch.nn.fuction as F
|
4 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
5 |
+
|
6 |
+
model_name="distilbert-base-uncased-finetuned-sst-2-english"
|
7 |
+
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
10 |
+
|
11 |
+
classifier = pipeline("sentiment-analysis",model=model, tokenizer=tokenizer)
|
12 |
+
|
13 |
+
result=classifier(["we hope you don't hate it."],
|
14 |
+
["I like your product"])
|
15 |
+
|
16 |
+
for result in result:
|
17 |
+
print(result)
|