Spaces:
Runtime error
Runtime error
Jeffrey Rathgeber Jr
commited on
vader test
Browse files
app.py
CHANGED
@@ -2,12 +2,13 @@ import streamlit as st
|
|
2 |
import tensorflow as tf
|
3 |
from transformers import pipeline
|
4 |
from textblob import TextBlob
|
|
|
5 |
|
6 |
classifier = pipeline(task="sentiment-analysis")
|
7 |
|
8 |
textIn = st.text_input("Input Text Here:", "I really like the color of your car!")
|
9 |
|
10 |
-
option = st.selectbox('Which pre-trained model would you like for your sentiment analysis?',('Pipeline', 'TextBlob', ''))
|
11 |
|
12 |
st.write('You selected:', option)
|
13 |
|
@@ -30,5 +31,9 @@ if option == 'TextBlob':
|
|
30 |
else:
|
31 |
sentiment = 'Positive'
|
32 |
|
33 |
-
st.write('According to
|
34 |
|
|
|
|
|
|
|
|
|
|
2 |
import tensorflow as tf
|
3 |
from transformers import pipeline
|
4 |
from textblob import TextBlob
|
5 |
+
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
6 |
|
7 |
classifier = pipeline(task="sentiment-analysis")
|
8 |
|
9 |
textIn = st.text_input("Input Text Here:", "I really like the color of your car!")
|
10 |
|
11 |
+
option = st.selectbox('Which pre-trained model would you like for your sentiment analysis?',('Pipeline', 'TextBlob', 'Vader'))
|
12 |
|
13 |
st.write('You selected:', option)
|
14 |
|
|
|
31 |
else:
|
32 |
sentiment = 'Positive'
|
33 |
|
34 |
+
st.write('According to TextBlob, input text is ', sentiment, ' and a subjectivity score (from 0 being objective to 1 being subjective) of ', subjectivity)
|
35 |
|
36 |
+
if option == 'Vader':
|
37 |
+
# vader
|
38 |
+
sentiment = SentimentIntensityAnalyzer().polarity_scores(textIn)['compound']
|
39 |
+
st.write('According to Vader, input text is ', sentiment)
|