Spaces:
Sleeping
Sleeping
| 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, min_len,max_len): | |
| summary = summarizer(text,min_length=min_len,max_length=max_len) | |
| return summary[0]['summary_text'] | |
| # We instantiate the Textbox class | |
| #textbox = gr.Textbox(label="Summarizer: ", placeholder="Enter the text") | |
| demo = gr.Interface(fn=summary, inputs = [gr.Textbox(label=" : Summarize Your Text : ", placeholder="Enter the text"), gr.Slider(minimum=4, maximum=10, step=1), gr.Slider(minimum=10, maximum=500, step=20),] , outputs="text",) | |
| demo.launch() | |