Spaces:
Paused
Paused
| import torch | |
| import gradio as gr | |
| # Use a pipeline as a high-level helper | |
| from transformers import pipeline | |
| text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6", torch_dtype=torch.bfloat16) | |
| # For Local we can use this only | |
| # text = "Elon Reeve Musk FRS (/ˈiːlɒn/; born June 28, 1971) is a businessman known for his key roles in the space company SpaceX and the automotive company Tesla, Inc. His other involvements include ownership of X Corp., the company that operates the social media platform X (formerly Twitter), and his role in the founding of the Boring Company, xAI, Neuralink, and OpenAI. Musk is the wealthiest individual in the world; as of November 2024, Forbes estimates his net worth to be US$323 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=[gr.Textbox(label="Input text to summarize", lines=6)], | |
| outputs=[gr.Textbox(label="Summarized text", lines=10)], | |
| title = "Gen AI Text Summarization", | |
| description= "Enter details text the tool will give you summarized text" | |
| ) | |
| demo.launch(share=True) |