RajSang commited on
Commit
3fc184d
1 Parent(s): 3ed0c57

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("summarization", model="RajSang/pegasus-sports-titles")
5
+
6
+ def sportyify(article):
7
+ gen_kwargs = {"length_penalty":0.6,"num_beams":4, "max_length": 48}
8
+ return pipe(article, **gen_kwargs)[0]["summary_text"]
9
+
10
+
11
+ iface = gr.Interface(fn=sportyify,
12
+ inputs=gr.inputs.Textbox(lines=50, placeholder="Paste Article Text Here"),
13
+ outputs="text",
14
+ title="SPORT-Y Titles",
15
+ description="Generate titles for sports articles and sports news")
16
+
17
+ iface.launch(enable_queue=True)