parjun commited on
Commit
9c468a3
·
verified ·
1 Parent(s): 9db70ab

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+ # Use a pipeline as a high-level helper
5
+ from transformers import pipeline
6
+
7
+ text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
8
+
9
+
10
+
11
+ def summary (input):
12
+ output = text_summary(input)
13
+ return output[0]['summary_text']
14
+
15
+ gr.close_all()
16
+
17
+ # demo = gr.Interface(fn=summary, inputs="text",outputs="text")
18
+ demo = gr.Interface(fn=summary,
19
+ inputs=[gr.Textbox(label="Input text to summarize",lines=6)],
20
+ outputs=[gr.Textbox(label="Summarized text",lines=4)],
21
+ title=" Testing_Text_Summarizer: Text Summarizer",
22
+ description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
23
+ demo.launch()
24
+
25
+