UMG / app.py
JonhyD's picture
Upload 2 files
42cd0f8
raw
history blame contribute delete
534 Bytes
# 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()