Spaces:
Runtime error
Runtime error
added new model
Browse files
app.py
CHANGED
@@ -11,6 +11,13 @@ def bertweet(data):
|
|
11 |
|
12 |
return label, score
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
def getSent(data, model):
|
16 |
if(model == 'Bertweet'):
|
@@ -18,7 +25,11 @@ def getSent(data, model):
|
|
18 |
col1, col2 = st.columns(2)
|
19 |
col1.metric("Feeling",label,None)
|
20 |
col2.metric("Score",score,None)
|
21 |
-
|
|
|
|
|
|
|
|
|
22 |
|
23 |
def rendPage():
|
24 |
st.title("Sentiment Analysis")
|
@@ -26,7 +37,7 @@ def rendPage():
|
|
26 |
st.text("")
|
27 |
type = st.selectbox(
|
28 |
'Choose your model',
|
29 |
-
('Bertweet','
|
30 |
st.text("")
|
31 |
|
32 |
if st.button('Calculate'):
|
|
|
11 |
|
12 |
return label, score
|
13 |
|
14 |
+
def twitterxlm(data):
|
15 |
+
specific_model = pipeline("cardiffnlp/twitter-xlm-roberta-base-sentiment")
|
16 |
+
result = specific_model(data)
|
17 |
+
label = result[0]['label']
|
18 |
+
score = result[0]['score']
|
19 |
+
|
20 |
+
return label, score
|
21 |
|
22 |
def getSent(data, model):
|
23 |
if(model == 'Bertweet'):
|
|
|
25 |
col1, col2 = st.columns(2)
|
26 |
col1.metric("Feeling",label,None)
|
27 |
col2.metric("Score",score,None)
|
28 |
+
elif(model == 'twitterXLM'):
|
29 |
+
label,score = twitterxlm(data)
|
30 |
+
col1, col2 = st.columns(2)
|
31 |
+
col1.metric("Feeling",label,None)
|
32 |
+
col2.metric("Score",score,None)
|
33 |
|
34 |
def rendPage():
|
35 |
st.title("Sentiment Analysis")
|
|
|
37 |
st.text("")
|
38 |
type = st.selectbox(
|
39 |
'Choose your model',
|
40 |
+
('Bertweet','twitterXLM',))
|
41 |
st.text("")
|
42 |
|
43 |
if st.button('Calculate'):
|