Image_Caption / app.py
Rekham1110's picture
Update app.py
6df6b52 verified
raw
history blame contribute delete
684 Bytes
import gradio as gr
from transformers import pipeline
# Load the Hugging Face pre-trained summarization model
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
# Define the function for text summarization
def summarize_text(input_text):
# Get the summary from the model
summary = summarizer(input_text, max_length=150, min_length=50, do_sample=False)
return summary[0]['summary_text']
# Create the Gradio interface
interface = gr.Interface(fn=summarize_text, inputs="text", outputs="text", title="Text Summarization App",
description="Enter a long text to get a summarized version.")
# Launch the app
interface.launch()