Walid Ahmed
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,4 +10,56 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Text Summarization Tool
|
| 14 |
+
|
| 15 |
+
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.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- **Model Selection**: Choose from a list of pre-trained summarization models available on Hugging Face.
|
| 20 |
+
- **Interactive Interface**: Load a model, input text, and get summaries directly from the web interface.
|
| 21 |
+
- **Customizable Summary Length**: Set the minimum and maximum summary length as a percentage of the original text.
|
| 22 |
+
- **Error Handling**: Provides error messages if the input text exceeds the model's token limit.
|
| 23 |
+
|
| 24 |
+
## Models Supported
|
| 25 |
+
|
| 26 |
+
- google/bigbird-pegasus-large-arxiv
|
| 27 |
+
- facebook/bart-large-cnn
|
| 28 |
+
- google/t5-v1_1-large
|
| 29 |
+
- sshleifer/distilbart-cnn-12-6
|
| 30 |
+
- allenai/led-base-16384
|
| 31 |
+
- google/pegasus-xsum
|
| 32 |
+
- togethercomputer/LLaMA-2-7B-32K
|
| 33 |
+
|
| 34 |
+
## Usage
|
| 35 |
+
|
| 36 |
+
1. **Select a Model**: Choose a summarization model from the dropdown menu.
|
| 37 |
+
2. **Load the Model**: Click the "Load Model" button to load the selected model.
|
| 38 |
+
3. **Set Summary Length**:
|
| 39 |
+
- Adjust the sliders to set the minimum and maximum summary length as a percentage of the original text.
|
| 40 |
+
4. **Enter Text**: Input the text you want to summarize in the provided text box.
|
| 41 |
+
5. **Generate Summary**: Click the "Summarize Text" button to generate the summary.
|
| 42 |
+
|
| 43 |
+
## Code Overview
|
| 44 |
+
|
| 45 |
+
### `load_model(model_name)`
|
| 46 |
+
Loads the selected summarization model and its tokenizer, and determines the maximum token length.
|
| 47 |
+
|
| 48 |
+
### `summarize_text(input, min_length, max_length)`
|
| 49 |
+
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.
|
| 50 |
+
|
| 51 |
+
## Example
|
| 52 |
+
|
| 53 |
+
1. Select the model `facebook/bart-large-cnn` from the dropdown menu.
|
| 54 |
+
2. Click the "Load Model" button.
|
| 55 |
+
3. Set the minimum summary length to 10% and the maximum summary length to 20% using the sliders.
|
| 56 |
+
4. Enter the text you want to summarize in the input text box.
|
| 57 |
+
5. Click the "Summarize Text" button to see the summarized text in the output box.
|
| 58 |
+
|
| 59 |
+
## License
|
| 60 |
+
|
| 61 |
+
This project is licensed under the MIT License.
|
| 62 |
+
|
| 63 |
+
## Created by
|
| 64 |
+
|
| 65 |
+
This tool was created by **Walid Ahmed**.
|