import gradio as gr from transformers import pipeline get_completion = pipeline("summarization", model="Falconsai/text_summarization") def summarize(input): output = get_completion(input) return output[0]['summary_text'] with gr.Blocks() as demo: gr.Markdown("# Summarisation with Falconsai") with gr.Row(): with gr.Column(min_width=900): inputs = gr.Textbox(label="Text to summarize", lines=6) btn = gr.Button("Submit") #Submit button outputs = gr.Textbox(label="Result", lines=3) btn.click(fn=summarize, inputs=[inputs], outputs=[outputs]) gr.close_all() demo.launch(share=True)