Spaces:
Runtime error
Runtime error
Update sentiment-analyser.py
Browse files- sentiment-analyser.py +3 -2
sentiment-analyser.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
st.title('Sentiment Analyser App')
|
5 |
st.write('Welcome to my sentiment analysis app!')
|
@@ -14,7 +14,8 @@ def classification(user_input, type):
|
|
14 |
if type=="sentiment-analysis":
|
15 |
classifier = pipeline("sentiment-analysis")
|
16 |
elif type=="twitter-xlm-roberta-base-sentiment":
|
17 |
-
|
|
|
18 |
result = classifier(user_input)[0]
|
19 |
return result
|
20 |
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline, AutoTokenizer
|
3 |
|
4 |
st.title('Sentiment Analyser App')
|
5 |
st.write('Welcome to my sentiment analysis app!')
|
|
|
14 |
if type=="sentiment-analysis":
|
15 |
classifier = pipeline("sentiment-analysis")
|
16 |
elif type=="twitter-xlm-roberta-base-sentiment":
|
17 |
+
tokenizer=AutoTokenizer.from_pretrained(βcardiffnlp/twitter-xlm-roberta-base-sentimentβ, use_fast=False)
|
18 |
+
classifier = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment", tokenizer)
|
19 |
result = classifier(user_input)[0]
|
20 |
return result
|
21 |
|