File size: 534 Bytes
42cd0f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Jonatan Leonardo Rodríguez Ocampo
# Rafael de Jesús Anguiano Suárez del Real
# Examen 2: Sentiment Analysis
from textblob import TextBlob
import gradio as gr
def greet(sentence):
sentence = TextBlob(sentence)
if sentence.sentiment.polarity < 0:
sentiment = "negative"
elif sentence.sentiment.polarity > 0:
sentiment = "positive"
else :
sentiment = "neutral"
return "This is a " + sentiment + " sentiment"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch() |