Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import transformers
|
2 |
+
from transformers import pipeline
|
3 |
+
import sentencepiece
|
4 |
+
classifier=pipeline('sentiment-analysis',model='distilbert/distilbert-base-uncased-finetuned-sst-2-english')
|
5 |
+
def get_sentiment(text):
|
6 |
+
sentiment=classifier(text)
|
7 |
+
return sentiment[0]['label']
|
8 |
+
interface=gr.Interface(get_sentiment,title='sentiment analysis',inputs='text',outputs='text').launch()
|