# 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() |