Text_summarizer / app.py
TNK21's picture
Update app.py
8da1870
raw
history blame contribute delete
654 Bytes
import gradio as gr
from transformers import pipeline
# Load the text summarization pipeline from Hugging Face Transformers
summarizer = pipeline("summarization")
def summarize_text(input_text):
summary = summarizer(input_text, max_length=150, min_length=30, do_sample=False)[0]['summary_text']
return summary
# Interface for the Gradio app
iface = gr.Interface(
fn=summarize_text,
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
outputs=gr.outputs.Textbox(label="Summary"),
title="Text Summarizer",
description="Enter a piece of text, and the app will provide a summary.",
)
# Launch the Gradio app
iface.launch()