Spaces:
Sleeping
Sleeping
Create app.txt
Browse files
app.txt
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from textblob import TextBlob
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def analyze_sentiment(text):
|
5 |
+
blob = TextBlob(text)
|
6 |
+
polarity = blob.sentiment.polarity
|
7 |
+
|
8 |
+
if polarity > 0:
|
9 |
+
sentiment = 'Positivo'
|
10 |
+
elif polarity < 0:
|
11 |
+
sentiment = 'Negativo'
|
12 |
+
else:
|
13 |
+
sentiment = 'Neutro'
|
14 |
+
|
15 |
+
return sentiment
|
16 |
+
|
17 |
+
description = """
|
18 |
+
<p>Este experimento pretende analizar los sentimientos de acuerdo a lo que escribimos, pretende ayudar a tener una idea de los comentarios de publicaciones
|
19 |
+
</p>
|
20 |
+
"""
|
21 |
+
|
22 |
+
iface = gr.Interface(
|
23 |
+
fn=analyze_sentiment,
|
24 |
+
title="Analizador de sentimientos en Inglés",
|
25 |
+
description=description,
|
26 |
+
inputs=gr.Textbox(lines=2, placeholder="Escribe algo para comenzar", label='Escribe algo para comenzar'),
|
27 |
+
outputs=gr.Textbox(label="Tu resultado"),
|
28 |
+
theme='peach'
|
29 |
+
)
|
30 |
+
|
31 |
+
iface.queue(max_size=10)
|
32 |
+
iface.launch()
|