import torch import gradio as gr from transformers import pipeline # Load the summarization pipeline using a pre-trained model from Hugging Face text_summary = pipeline("summarization", model="sshleifer/distilbart-xsum-12-6") # Input text for summarization # text = """ # The India vs England cricket series in early 2025 was a comprehensive display of India's dominance in both T20I and ODI formats, # culminating in a 4-1 T20I series win and a 3-0 ODI whitewash. The T20I series began with India asserting their supremacy, notably in # the first match where Abhishek Sharma's explosive 79 off 36 balls led India to a swift chase of England's 132, setting the tone for the # series. England managed to pull one back in the third T20I, securing a 26-run victory in Rajkot, with Ben Duckett scoring a half-century # and their bowlers, including Jofra Archer and Brydon Carse, sharing seven wickets to halt India's winning streak. However, India's # resilience shone through in the fourth T20I, where a controversial concussion substitution saw Harshit Rana replace Shivam Dube # and claim three crucial wickets, aiding India in clinching the series with a 15-run win. The final T20I was a spectacle, # with Abhishek Sharma delivering a record-breaking 135 off 54 balls, propelling India to a massive total of 247/9. # England's response was lackluster, collapsing to 97 all out, handing India a resounding 150-run victory and a 4-1 # series triumph. Transitioning to the ODIs, India continued their dominance. In the first ODI, Shubman Gill's 87 # anchored India's chase of 249, securing a four-wicket win. The second ODI saw Rohit Sharma's commanding 119 off 76 balls # lead India to a successful chase of England's 304, despite a brief floodlight malfunction. The final ODI was a testament # to India's batting prowess, with Shubman Gill scoring 112, supported by Virat Kohli and Shreyas Iyer, setting a formidable # total of 356. England's batting faltered, managing only 214, as India's bowlers, including Axar Patel and Harshit Rana, # dismantled their lineup, sealing a 142-run victory and a 3-0 series sweep. Throughout the series, India's blend of # experienced players and emerging talents showcased their depth and adaptability, while England struggled to find consistency, # highlighting the challenges they face in adapting to subcontinental conditions. # """ # # summary # 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=4), title="@GenAILearniverse Project 1: Text Summarizer", description="THIS APPLICATION WILL BE USED TO SUMMARIZE THE TEXT" ) demo.launch()