LovnishVerma commited on
Commit
17822e0
1 Parent(s): e5ae3b9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
+
6
+ def summarize_text(input_text):
7
+ summary = summarizer(input_text, max_length=150, min_length=50, length_penalty=2.0, num_beams=4, early_stopping=True)
8
+ return summary[0]['summary_text']
9
+
10
+ iface = gr.Interface(
11
+ fn=summarize_text,
12
+ inputs=gr.Textbox(),
13
+ outputs=gr.Textbox(),
14
+ live=True,
15
+ title="Text Summarization App",
16
+ description="Enter a longer document, and the model will generate a summary.",
17
+ )
18
+
19
+ iface.launch()