CoolFace
Apppublic

Magali/sentiment

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py20 linesDownload Raw Back to root
1import nltk2 3from nltk.sentiment.vader import SentimentIntensityAnalyzer4 5import gradio as gr6 7 8nltk.download("vader_lexicon")9sid = SentimentIntensityAnalyzer()10 11def sentiment_analysis(text):12    scores = sid.polarity_scores(text)13    del scores["compound"]14    return scores15 16iface = gr.Interface(sentiment_analysis, "textbox", "label", interpretation="default")17 18iface.test_launch()19if __name__ == "__main__":20    iface.launch()