Spaces:
Sleeping
Sleeping
| 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) | |
| # model_path=("../Models/models--sshleifer--distilbart-cnn-12-6/snapshots" | |
| # "/a4f8f3ea906ed274767e9906dbaede7531d660ff") | |
| # text_summary = pipeline("summarization", model=model_path,torch_dtype=torch.bfloat16) | |
| # text="Elon Reeve Musk FRS is a businessman. He is known for his leadership of Tesla, SpaceX, X, and the Department of Government Efficiency. Musk has been considered the wealthiest person in the world since 2021; as of May 2025, Forbes estimates his net worth to be US$424.7 billion. Wikipedia | |
| # Born: 28 June 1971 (age 54 years), Pretoria, South Africa | |
| # Net worth: 40,980 crores USD (2025) Forbes | |
| # Children: Vivian Jenna Wilson, Tau Techno Mechanicus Musk · See more | |
| # Spouse: Talulah Riley (m. 2013–2016), Talulah Riley (m. 2010–2012), Justine Musk (m. 2000–2008) | |
| # Education: University of Pennsylvania School of Arts and Sciences (1997) · See more | |
| # Organizations founded: Tesla · See more | |
| # Books: Elon Musk" | |
| # 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="summarized text", lines=4)], | |
| title="@GenAILearniverse Project 1 : Text Summarizer", | |
| description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT" ) | |
| demo.launch() |