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()