File size: 431 Bytes
1d2c976 fe15f4b 50e0ebf a5473d7 50e0ebf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import gradio as gr
nltk.download("vader_lexicon")
sid = SentimentIntensityAnalyzer()
def sentiment_analysis(text):
scores = sid.polarity_scores(text)
del scores["compound"]
return scores
iface = gr.Interface(sentiment_analysis, "textbox", "label", interpretation="default")
iface.test_launch()
if __name__ == "__main__":
iface.launch() |