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