Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| summarizer = pipeline( | |
| "summarization", | |
| 'pszemraj/led-large-book-summary' | |
| ) | |
| def summarizer(text): | |
| result = summarizer( | |
| text, | |
| min_length=16, | |
| max_length=256, | |
| no_repeat_ngram_size=3, | |
| encoder_no_repeat_ngram_size=3, | |
| repetition_penalty=3.5, | |
| num_beams=4, | |
| early_stopping=True, | |
| ) | |
| with gr.Blocks() as demo: | |
| gr.Markdown("#Text-to-Image Generator") | |
| text = gr.Textbox(label="Text Input", placeholder="Enter your text......") | |
| submit_btn = gr.Button("Summarize") | |
| summary = gr.Textbox(label="Summary") | |
| submit_btn.click(fn=summarizer, inputs=text, outputs=summary) | |
| demo.launch() |