# -*- coding: utf-8 -*- """Copy of text summarization.ipynb Automatically generated by Colab. Original file is located at https://colab.research.google.com/drive/12ph83wSwEKGni2qgQjSRJE-EY0KJs-jL """ import gradio as gr # Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("summarization", model="facebook/bart-large-cnn") def summarize_text(text): result = pipe(text, max_length=500, min_length=30, do_sample=False) # Extract the summary from the result # summary = result[0]['generated_text'] return result iface = gr.Interface( fn=summarize_text, inputs = gr.Textbox(lines=4, placeholder="Enter text to summarize..."), outputs = "text", title="Text Summarizer", description="Enter text and get a concise summary.", ) iface.launch(share = True)