text-summarizer / README.md
RawadAlghamdi's picture
Update README.md
a7e5378 verified

A newer version of the Gradio SDK is available: 6.13.0

Upgrade
metadata
title: Text Summarizer
emoji: 🌍
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 5.17.1
app_file: app.py
pinned: false
license: apache-2.0

Text Summarizer

This repository provides a simple text summarization web application that leverages Hugging Face's Transformers library and Gradio to create an interactive interface. It uses the facebook/bart-large-cnn model to generate summaries from user-provided text and is deployed exclusively on Hugging Face Spaces.

Features

  • Summarization: Generate summaries for long pieces of text.
  • Web Interface: Easy-to-use interface powered by Gradio.
  • Customizable Parameters: Adjust summary length by modifying the min_length and max_length parameters.
  • Deployed on Hugging Face Spaces: Access the application directly online without local setup.

Requirements

Note: The app is deployed on Hugging Face Spaces and can be accessed directly online.

Usage

Accessing the Deployed Application

Visit the following URL to use the app directly on Hugging Face Spaces:
https://huggingface.co/spaces/RawadAlghamdi/text-summarizer

Running Locally

If you prefer to run the application on your local machine, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/text-summarizer.git
    cd text-summarizer
    
  2. Create and activate a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
    
  3. Install the required packages:

    pip install gradio transformers torch
    
  4. Run the application:

    python app.py
    
  5. Access the interface:

    Open the URL provided in the terminal (typically http://127.0.0.1:7860) in your web browser.

Code Overview

  • app.py: Main application file containing:
    • Import statements for Gradio and Transformers.
    • Loading the summarization pipeline with the facebook/bart-large-cnn model.
    • The summarize(text) function that processes input text.
    • Setup of Gradio components (input and output textboxes) with descriptive labels.
    • Creation and launch of the Gradio interface.

Customization

  • Adjusting Summary Length: Modify the min_length and max_length parameters in the summarize function to control the output summary length.
  • Using a Different Model: To switch to another summarization model, update the model parameter in the pipeline initialization.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.