Spaces:
Runtime error
Runtime error
edit
Browse files
app.py
CHANGED
@@ -27,6 +27,21 @@ def roberta(data):
|
|
27 |
|
28 |
return label, score
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
def getSent(data, model):
|
31 |
if(model == 'Bertweet'):
|
32 |
label,score = bertweet(data)
|
@@ -38,6 +53,11 @@ def getSent(data, model):
|
|
38 |
col1, col2 = st.columns(2)
|
39 |
col1.metric("Feeling",label,None)
|
40 |
col2.metric("Score",score,None)
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
def rendPage():
|
43 |
st.title("Sentiment Analysis")
|
@@ -45,7 +65,7 @@ def rendPage():
|
|
45 |
st.text("")
|
46 |
type = st.selectbox(
|
47 |
'Choose your model',
|
48 |
-
('Bertweet','Roberta',))
|
49 |
st.text("")
|
50 |
|
51 |
if st.button('Calculate'):
|
|
|
27 |
|
28 |
return label, score
|
29 |
|
30 |
+
def siebert(data):
|
31 |
+
specific_model = pipeline(model='siebert/sentiment-roberta-large-english')
|
32 |
+
result = specific_model(data)
|
33 |
+
label = result[0]['label']
|
34 |
+
score = result[0]['score']
|
35 |
+
|
36 |
+
if(label == 'LABEL_0'):
|
37 |
+
label = 'Negative'
|
38 |
+
elif(label == 'LABEL_1'):
|
39 |
+
label = 'Neutral'
|
40 |
+
else:
|
41 |
+
label = 'Positive'
|
42 |
+
|
43 |
+
return label, score
|
44 |
+
|
45 |
def getSent(data, model):
|
46 |
if(model == 'Bertweet'):
|
47 |
label,score = bertweet(data)
|
|
|
53 |
col1, col2 = st.columns(2)
|
54 |
col1.metric("Feeling",label,None)
|
55 |
col2.metric("Score",score,None)
|
56 |
+
elif(model == 'Siebert'):
|
57 |
+
label,score = siebert(data)
|
58 |
+
col1, col2 = st.columns(2)
|
59 |
+
col1.metric("Feeling",label,None)
|
60 |
+
col2.metric("Score",score,None)
|
61 |
|
62 |
def rendPage():
|
63 |
st.title("Sentiment Analysis")
|
|
|
65 |
st.text("")
|
66 |
type = st.selectbox(
|
67 |
'Choose your model',
|
68 |
+
('Bertweet','Roberta','Siebert'))
|
69 |
st.text("")
|
70 |
|
71 |
if st.button('Calculate'):
|