Walid-Ahmed's picture
Update README.md
411da6f verified

A newer version of the Gradio SDK is available: 4.42.0

Upgrade
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

Advanced Text Summarization Tool

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

  1. Select a Model: Choose a summarization model from the dropdown menu.
  2. Load the Model: Click the "Load Model" button to load the selected model.
  3. Set Summary Length:
    • Adjust the sliders to set the minimum and maximum summary length as a percentage of the original text.
  4. Enter Text: Input the text you want to summarize in the provided text box.
  5. 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

  1. Select the model facebook/bart-large-cnn from the dropdown menu.
  2. Click the "Load Model" button.
  3. Set the minimum summary length to 10% and the maximum summary length to 20% using the sliders.
  4. Enter the text you want to summarize in the input text box.
  5. 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.