Spaces:
No application file
No application file
Commit ·
be10907
1
Parent(s): 9589558
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,14 +3,12 @@ from transformers import pipeline
|
|
| 3 |
from textblob import TextBlob
|
| 4 |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
| 5 |
|
| 6 |
-
# Load pretrained models
|
| 7 |
models = {
|
| 8 |
'DistilBERT': pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english'),
|
| 9 |
'TextBlob': None,
|
| 10 |
'VADER': None
|
| 11 |
}
|
| 12 |
|
| 13 |
-
# Define TextBlob and VADER functions for sentiment analysis
|
| 14 |
def textblob_sentiment(text):
|
| 15 |
polarity = TextBlob(text).sentiment.polarity
|
| 16 |
if polarity > 0:
|
|
@@ -33,7 +31,6 @@ def vader_sentiment(text):
|
|
| 33 |
models['TextBlob'] = textblob_sentiment
|
| 34 |
models['VADER'] = vader_sentiment
|
| 35 |
|
| 36 |
-
# Create Streamlit interface
|
| 37 |
st.title('Sentiment Analysis App')
|
| 38 |
|
| 39 |
text = st.text_input('Enter some text')
|
|
|
|
| 3 |
from textblob import TextBlob
|
| 4 |
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
| 5 |
|
|
|
|
| 6 |
models = {
|
| 7 |
'DistilBERT': pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english'),
|
| 8 |
'TextBlob': None,
|
| 9 |
'VADER': None
|
| 10 |
}
|
| 11 |
|
|
|
|
| 12 |
def textblob_sentiment(text):
|
| 13 |
polarity = TextBlob(text).sentiment.polarity
|
| 14 |
if polarity > 0:
|
|
|
|
| 31 |
models['TextBlob'] = textblob_sentiment
|
| 32 |
models['VADER'] = vader_sentiment
|
| 33 |
|
|
|
|
| 34 |
st.title('Sentiment Analysis App')
|
| 35 |
|
| 36 |
text = st.text_input('Enter some text')
|