from textblob import TextBlob import gradio as gr def analyze_sentiment(text): blob = TextBlob(text) polarity = blob.sentiment.polarity if polarity > 0 : sentiment = 'Positivo' elif polarity < 0 : sentiment = 'Negativo' else: sentiment = 'Neutro' iface = gr.Interface(fn=make_new_sonnet, title= "Generador de poesía basada en sonetos en español", description = description, inputs=[ gr.Textbox(lines=2, placeholder="Escrbe algo para comenzar", label='Escribe algo para comenzar'), gr.Slider(minimum = 20, maximum = 200, value = 140, step = 5, label='Salida máxima de caracteres')], outputs=[ gr.Textbox(label="Tu poema"), ], article= article, examples = examples, theme = 'peach' ) iface.queue(max_size=10) iface.launch()