import gradio as gr from transformers import pipeline #api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B") #api = gr.Interface.load("./models/mt5-small-finetuned-amazon-en-es") #api = gr.Interface.load("huggingface/vhpvmx/mt5-small-finetuned-amazon-en-es") #ESTE LO CARGA hub_model_id = "vhpvmx/mt5-small-finetuned-amazon-en-es" summarizer = pipeline("summarization", model=hub_model_id) #model="./models/mt5-small-finetuned-amazon-en-es" #summarizer = pipeline("summarization", model) def summary(text): return summarizer(text)[0]["summary_text"] with gr.Blocks() as demo: input_text = gr.Textbox(placeholder="Ingresa la reseƱa del libro...", lines=4) output_text = gr.Textbox(label="Resumen") btn = gr.Button("Genera el resumen") btn.click(summary, input_text, output_text) demo.launch()