import gradio as gr from transformers import pipeline get_completion = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6") def summarize(input): output = get_completion(input) return output[0]['summary_text'] demo = gr.Interface(fn=summarize, # inputs=[gr.Textbox(label="Text to summarize", lines=6)], # outputs=[gr.Textbox(label="Result", lines=3)], # title="Text summarization with distilbart-cnn", # description="Summarize any text using the `shleifer/distilbart-cnn-12-6` model under the hood!" inputs=[gr.Textbox(label="What do you want summarize !", lines=6)], outputs=[gr.Textbox(label="Magic Summarization !!!", lines=3)], title="Text summarization test and demo app by Srinivas.V ..", examples = ['''I am a business leader with almost 3 decades of work experience in the Information Technology and Services industry. As a management professional, I have a proven and successful track record backed up by strong and demonstrable skills in business planning, operations, development, sustenance, profitability and growth. After spending 27+ years in business management and leadership roles, I wonder how many would really venture into a big career switch! Well, I didπŸ˜€πŸ˜. Over the past 3 years, during the tough Covid times, I have spent hours, days and months learning data science and machine learning skills which I find close to my heart; probably my love for maths as a child did the trickπŸ˜€πŸ˜. Guess it took decades for me to find my passion.πŸ˜€πŸ˜. Managing, nurturing and leading teams, optimising and delivering value to stakeholders had been my key focus area for the last 15+ years. Putting together processes, systems, people, procedures, processes, structures and optimising cost/ benefits and risk/ returns are some of my key fortes. I was instrumental in building and growing the business for some of the companies that I have worked for by several folds. I have been lucky, I always had wonderful teams working with me, helping me, both up and down the ladder, making everything possible for me. To compliment my professional career and as a personal interest, I indulge a lot in self learning. I love and cherish a lot my very active engagement in Toastmasters International, where I won several awards at club and area levels. Toastmasters had helped me a lot in improving my personality and outlook. Similarly, my association with ISACA gave me the opportunity to learn a lot about value deliverance, governance, management, business processes, risk management and taking a wholistic approach to business and many other invaluable principles. Work opportunities where I can mix my passion for DS & ML and my decades of experience in business management and leadership excite me, and this is where I can bring significant value to the table. Keeping work aside, I am an avid player of badminton and chess. I also enjoy swimming, travelling and holidaying along with my lovely wife whenever I get a chance. If you know me, I love to hear from you and have your valuable feedback and suggestions. If you don't know me, but would like to connect with me, you may reach me at srinivasvalmeti@gmail.com. Finally, I thank everyone who help create and grow lovely and amazing technology platforms like LinkedIn. I wish everyone all the best. Cheers!!'''], description="Summarize any text", allow_flagging="never" ) demo.launch()