File size: 633 Bytes
e6665e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import torch
import gradio as gr
from transformers import pipeline



text_summary = pipeline("summarization", model= "sshleifer/distilbart-xsum-12-6" )

def summarise_txt(input):
    output = text_summary(input)
    return output[0]['summary_text']

gr.close_all()
demo = gr.Interface(
    fn= summarise_txt,
    inputs= [gr.Textbox(label="input a text to summarize in here", lines=8)],
    outputs= [gr.Textbox(label= "text after summarization", lines= 4)],
    title= "text summarizer project",
    description= "the project takes a text as input and a summarized text as an output using hugging face models"

)
demo.launch()