Legan/ActivityShida
0
1from textblob import TextBlob2import gradio as gr3 4 5def greet(sentence):6 sentence = TextBlob(sentence)7 if sentence.sentiment.polarity < 0:8 sentiment = "negative"9 elif sentence.sentiment.polarity > 0:10 sentiment = "positive"11 else :12 sentiment = "neutral"13 return "your sentence has a " + sentiment + " sentiment"14 15demo = gr.Interface(fn=greet, inputs="text", outputs="text")16 17demo.launch() 