A newer version of the Gradio SDK is available:
4.42.0
metadata
title: Advanced Text Summarization
emoji: π
colorFrom: pink
colorTo: blue
sdk: gradio
sdk_version: 4.36.0
app_file: app.py
pinned: false
license: apache-2.0
Text Summarization Tool
This Hugging Face Space hosts a web-based tool for summarizing text using various pre-trained models from Hugging Face. The tool allows users to load different summarization models, set the desired summary length as a percentage of the original text, and generate summaries interactively.
Features
- Model Selection: Choose from a list of pre-trained summarization models available on Hugging Face.
- Interactive Interface: Load a model, input text, and get summaries directly from the web interface.
- Customizable Summary Length: Set the minimum and maximum summary length as a percentage of the original text.
- Error Handling: Provides error messages if the input text exceeds the model's token limit.
Models Supported
- google/bigbird-pegasus-large-arxiv
- facebook/bart-large-cnn
- google/t5-v1_1-large
- sshleifer/distilbart-cnn-12-6
- allenai/led-base-16384
- google/pegasus-xsum
- togethercomputer/LLaMA-2-7B-32K
Usage
- Select a Model: Choose a summarization model from the dropdown menu.
- Load the Model: Click the "Load Model" button to load the selected model.
- Set Summary Length:
- Adjust the sliders to set the minimum and maximum summary length as a percentage of the original text.
- Enter Text: Input the text you want to summarize in the provided text box.
- Generate Summary: Click the "Summarize Text" button to generate the summary.
Code Overview
load_model(model_name)
Loads the selected summarization model and its tokenizer, and determines the maximum token length.
summarize_text(input, min_length, max_length)
Summarizes the input text using the loaded model, respecting the specified minimum and maximum summary lengths. If the input text exceeds the model's token limit, it returns an error message.
Example
- Select the model
facebook/bart-large-cnn
from the dropdown menu. - Click the "Load Model" button.
- Set the minimum summary length to 10% and the maximum summary length to 20% using the sliders.
- Enter the text you want to summarize in the input text box.
- Click the "Summarize Text" button to see the summarized text in the output box.
License
This project is licensed under the MIT License.
Created by
This tool was created by Walid Ahmed.