Spaces:
Runtime error
A newer version of the Gradio SDK is available: 6.13.0
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_lengthandmax_lengthparameters. - Deployed on Hugging Face Spaces: Access the application directly online without local setup.
Requirements
- Python 3.7 or higher (if running locally)
- Gradio
- Transformers
- PyTorch (or TensorFlow if preferred)
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:
Clone the repository:
git clone https://github.com/yourusername/text-summarizer.git cd text-summarizerCreate and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activateInstall the required packages:
pip install gradio transformers torchRun the application:
python app.pyAccess 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-cnnmodel. - 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_lengthandmax_lengthparameters in thesummarizefunction 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.