File size: 661 Bytes
ca146e9
677ba43
 
3d08384
c6c381f
 
 
 
 
 
 
f72f135
677ba43
9976475
c6c381f
677ba43
 
 
 
ca55f88
9976475
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from transformers import pipeline
import gradio as gr

model = pipeline("summarization", model="gsasikiran/bart-base-finetuned-cnn", tokenizer="facebook/bart-base")
title = "Article summarizer"
description = "Generate summaries for articles based on the input text."
article = ""

def generate_summary(text):
    summary_text = model(text)[0]['summary_text']
    summary_text = summary_text.replace("\n", " ")
    return summary_text

hf = gr.Interface(
    fn=generate_summary,
    inputs=gr.Textbox(lines=5, label="Input Text"),
    title=title,
    description=description,
    article=article,
    outputs = gr.Textbox(lines=2, label="Title")
)

hf.launch()