Spaces:
Runtime error
Runtime error
File size: 723 Bytes
bbfb60a 9af54b6 bbfb60a cd3b42f bbfb60a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import gradio as gr
from transformers import pipeline
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
def summarize(text: str, max_length: int, min_length: int, do_sample: bool=False):
result = summarizer(text, max_length, min_length, do_sample)
return result[0]["summary_text"]
summarizer_interface = gr.Interface(
summarize,
inputs=[
gr.Textbox(label="Enter the text to be summarized"),
gr.Slider(minimum=0, maximum=3000, step=100, label="Max Length", value=1000),
gr.Slider(minimum=0, maximum=100, step=10, label="Min Length", value=30),
gr.Checkbox(label="Do Sample", value=False)
],
outputs=gr.Textbox(label="Summarized Text"),
) |