TNK21 commited on
Commit
82352fb
·
1 Parent(s): 4717d96

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the text summarization pipeline from Hugging Face Transformers
5
+ summarizer = pipeline("summarization")
6
+
7
+ def summarize_text(input_text):
8
+ summary = summarizer(input_text, max_length=100, min_length=20, do_sample=False)[0]['summary_text']
9
+ return summary
10
+
11
+ # Interface for the Gradio app
12
+ iface = gr.Interface(
13
+ fn=summarize_text,
14
+ inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
15
+ outputs=gr.outputs.Textbox(label="Summary"),
16
+ title="Text Summarizer",
17
+ description="Enter a piece of text, and the app will provide a summary.",
18
+ )
19
+
20
+ # Launch the Gradio app
21
+ iface.launch()