AIROBOHUB commited on
Commit
4b96d50
·
verified ·
1 Parent(s): 4f6ec2f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+ #use pipeline as a high-level helper
5
+ from transformers import pipeline, Pipeline
6
+
7
+ text_summary = pipeline(task="summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16)
8
+
9
+ # model_path = ("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots"
10
+ # "/a4f8f3ea906ed274767e9906dbaede7531d660ff")
11
+ # text_summary = pipeline(task="summarization", model=model_path,
12
+ # torch_dtype=torch.bfloat16)
13
+
14
+ #
15
+ def summary (input):
16
+ output = text_summary(input)
17
+ return output[0]['summary_text']
18
+
19
+ gr.close_all()
20
+
21
+ # demo=gr.Interface(fn=summary, inputs="text", outputs="text", title="AI ROBO HUB Consulting Services Pvt. Ltd.", description="This AI App is used to SUMMARIZE THE GIVEN TEXT - +91 7893688993 | chrao@airobohub.com")
22
+
23
+ demo=gr.Interface(fn=summary,
24
+ inputs=[gr.Textbox(label="Input Text for Summary", lines=6)],
25
+ outputs=[gr.Textbox(label="Summarized Text",lines=6)],
26
+ title="AI ROBO HUB Consulting Services Pvt. Ltd.",
27
+ description="This AI App is used to SUMMARIZE THE GIVEN TEXT - It's POC, Accepts limited input text. - +91 7893688993 | chrao@airobohub.com")
28
+ demo.launch()