Spaces:
Running
Running
File size: 482 Bytes
d1ecd20 df52c6a d1ecd20 df52c6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
nltk.download("vader_lexicon")
sid = SentimentIntensityAnalyzer()
def sentiment_analysis(text):
scores = sid.polarity_scores(text)
del scores["compound"]
return scores
demo = gr.Interface(
fn=sentiment_analysis,
inputs=gr.Textbox(placeholder="Enter a positive or negative sentence here..."),
outputs="label",
examples=[["This is wonderful!"]])
demo.launch()
|