Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,11 @@ pipeline
|
|
31 |
|
32 |
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
analyzer = pipeline(
|
42 |
|
@@ -44,10 +43,7 @@ analyzer = pipeline(
|
|
44 |
|
45 |
)
|
46 |
def predict_sentiment(x):
|
47 |
-
return analyzer(x)
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
|
53 |
interface = gr.Interface(
|
@@ -55,7 +51,7 @@ interface = gr.Interface(
|
|
55 |
inputs='text',
|
56 |
outputs=['text'],
|
57 |
title='Croatian Movie reviews Sentiment Analysis',
|
58 |
-
examples= ["
|
59 |
description='Get the positive/neutral/negative sentiment for the given input.'
|
60 |
)
|
61 |
|
|
|
31 |
|
32 |
|
33 |
|
34 |
+
label2id = {
|
35 |
+
"LABEL_0": "negative",
|
36 |
+
"LABEL_1": "neutral",
|
37 |
+
"LABEL_2": "positive"
|
38 |
+
}
|
|
|
39 |
|
40 |
analyzer = pipeline(
|
41 |
|
|
|
43 |
|
44 |
)
|
45 |
def predict_sentiment(x):
|
46 |
+
return label2id[analyzer(x)[0]["label"]]
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
interface = gr.Interface(
|
|
|
51 |
inputs='text',
|
52 |
outputs=['text'],
|
53 |
title='Croatian Movie reviews Sentiment Analysis',
|
54 |
+
examples= ["Volim kavu","Ne volim kavu"],
|
55 |
description='Get the positive/neutral/negative sentiment for the given input.'
|
56 |
)
|
57 |
|