File size: 515 Bytes
a93c77c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import pandas as pd
from transformers import pipeline

summarizer = pipeline("summarization")

def summarize(text):
    return summarizer(text, max_length=250, min_length=30)[0]['summary_text']

gr.Interface(
    summarize, 
    gr.inputs.Textbox(lines=15, placeholder="Enter text here"), 
    [gr.outputs.Textbox(lines=10, placeholder="Summarized text will appear here")],
    title="Text Summarizer",
    description="Summarizes text using the transformer library",
    examples=[]
).launch()