File size: 533 Bytes
eaf7fab
 
8f5a2a6
eaf7fab
8f5a2a6
d946acc
8f5a2a6
eaf7fab
 
8c527ad
0a0869f
8f5a2a6
d946acc
 
4f8aea4
c9de3a1
8afb113
21b57f6
8afb113
 
 
c9de3a1
0a0869f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import pipeline 
import torch
import gradio as gr

summarizer = pipeline(task="summarization",
                      model="facebook/bart-large-cnn",
                      torch_dtype=torch.bfloat16)



# name of the function
def summary(text):
    summary = summarizer(text,min_length=10,max_length=100)
    return summary


# We instantiate the Textbox class
textbox = gr.Textbox(label="Summarizer: ", placeholder="Enter the text")


demo = gr.Interface(fn=summary, inputs=textbox, outputs="text")

demo.launch()