File size: 1,096 Bytes
c3f8de7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import torch 
import gradio as gr





# Use a pipeline as a high-level helper
from transformers import pipeline

text_summary = pipeline("summarization", model="ainize/bart-base-cnn",torch_dtype = torch.bfloat16)



# 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.'''

# print(text_summary(text))

def summary(input):
    output = text_summary(input)
    return output[0]['summary_text']

gr.close_all()

# demo = gr.Interface(fn=summary,inputs='text',outputs = 'text')

demo = gr.Interface(fn=summary,
                    inputs = [gr.Textbox(label="Input text to summarize ",lines=6)],
                    outputs = [gr.Textbox(label="summarization",lines=4)],
                    title="Text Summarization",
                    description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT")


demo.launch()