Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from textblob import TextBlob
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def analyze_sentiment(text):
|
5 |
+
blob = TextBlob(text)
|
6 |
+
|
7 |
+
polarity = blob.sentiment.polarity
|
8 |
+
|
9 |
+
if polarity > 0 :
|
10 |
+
sentiment = 'Positivo'
|
11 |
+
elif polarity < 0 :
|
12 |
+
sentiment = 'Negativo'
|
13 |
+
else:
|
14 |
+
sentiment = 'Neutro'
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=make_new_sonnet,
|
17 |
+
title= "Generador de poesía basada en sonetos en español",
|
18 |
+
description = description,
|
19 |
+
inputs=[
|
20 |
+
gr.Textbox(lines=2, placeholder="Escrbe algo para comenzar", label='Escribe algo para comenzar'),
|
21 |
+
gr.Slider(minimum = 20, maximum = 200, value = 140, step = 5, label='Salida máxima de caracteres')],
|
22 |
+
outputs=[
|
23 |
+
gr.Textbox(label="Tu poema"),
|
24 |
+
],
|
25 |
+
article= article,
|
26 |
+
examples = examples,
|
27 |
+
theme = 'peach'
|
28 |
+
)
|
29 |
+
iface.queue(max_size=10)
|
30 |
+
iface.launch()
|
31 |
+
|
32 |
+
|
33 |
+
|