luffycoder commited on
Commit
c3f8de7
·
verified ·
1 Parent(s): 5d10f41

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+
4
+
5
+
6
+
7
+
8
+ # Use a pipeline as a high-level helper
9
+ from transformers import pipeline
10
+
11
+ text_summary = pipeline("summarization", model="ainize/bart-base-cnn",torch_dtype = torch.bfloat16)
12
+
13
+
14
+
15
+ # text ='''Elon Reeve Musk FRS is an international businessman and entrepreneur known for his leadership of Tesla, SpaceX, X (formerly Twitter), and the Department of Government Efficiency (DOGE). Musk has been the wealthiest person in the world since 2021; as of May 2025, Forbes estimates his net worth to be US$424.7 billion.'''
16
+
17
+ # print(text_summary(text))
18
+
19
+ def summary(input):
20
+ output = text_summary(input)
21
+ return output[0]['summary_text']
22
+
23
+ gr.close_all()
24
+
25
+ # demo = gr.Interface(fn=summary,inputs='text',outputs = 'text')
26
+
27
+ demo = gr.Interface(fn=summary,
28
+ inputs = [gr.Textbox(label="Input text to summarize ",lines=6)],
29
+ outputs = [gr.Textbox(label="summarization",lines=4)],
30
+ title="Text Summarization",
31
+ description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")
32
+
33
+
34
+ demo.launch()