Sadem-12 commited on
Commit
09e1592
·
verified ·
1 Parent(s): 0586e69

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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(text):
7
+ summary = summarizer(text, min_length=10, max_length=100)
8
+ return summary[0]['summary_text']
9
+
10
+ interface = gr.Interface(
11
+ fn=summarize_text,
12
+ inputs=gr.Textbox(label="Enter Text", lines=10, placeholder="Paste your long text here..."),
13
+ outputs=gr.Textbox(label="Summarized Text"),
14
+ title="Text Summarizer",
15
+ description="This app uses the BART model to summarize your text into a concise form with a minimum of 10 tokens and a maximum of 100 tokens."
16
+ )
17
+
18
+ interface.launch()