Spaces:
Runtime error
Runtime error
File size: 827 Bytes
6364e0a 89c2a39 6364e0a 89c2a39 |
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 27 |
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()
|