File size: 712 Bytes
eba95f5
41d16e2
eba95f5
41d16e2
 
eba95f5
41d16e2
 
eba95f5
 
41d16e2
 
 
 
 
 
 
 
 
eba95f5
41d16e2
 
 
eba95f5
 
41d16e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from transformers import pipeline

# Cargar el pipeline de resumen
summarizer = pipeline("summarization")

def summarize_text(text):
    summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
    return summary[0]['summary_text']

# Crear la interfaz con Gradio
iface = gr.Interface(
    fn=summarize_text,
    inputs=gr.Textbox(lines=10, placeholder="Introduce el texto aquí..."),
    outputs=gr.Textbox(label="Resumen"),
    title="Generador de Resúmenes",
    description="Introduce un texto y obtendrás un resumen generado automáticamente.",
    allow_flagging="never"
)

# Ejecutar la interfaz
def main():
    iface.launch()

if __name__ == "__main__":
    main()