SPORT-Y_Titles / app.py
RajSang's picture
Create app.py
3fc184d
raw
history blame
623 Bytes
import gradio as gr
from transformers import pipeline
pipe = pipeline("summarization", model="RajSang/pegasus-sports-titles")
def sportyify(article):
gen_kwargs = {"length_penalty":0.6,"num_beams":4, "max_length": 48}
return pipe(article, **gen_kwargs)[0]["summary_text"]
iface = gr.Interface(fn=sportyify,
inputs=gr.inputs.Textbox(lines=50, placeholder="Paste Article Text Here"),
outputs="text",
title="SPORT-Y Titles",
description="Generate titles for sports articles and sports news")
iface.launch(enable_queue=True)