tech-rakesh-ai commited on
Commit
cecfdca
·
verified ·
1 Parent(s): e4f2561

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
6
+
7
+
8
+ # model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
9
+ # "/a4f8f3ea906ed274767e9906dbaede7531d660ff")
10
+
11
+ def summary(input_text):
12
+ output = text_summary(input_text)
13
+ return output[0]['summary_text']
14
+
15
+
16
+ gr.close_all()
17
+
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="@CreativeAI Studio India: Text Summarizer",
22
+ description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
23
+ demo.launch()