Using AI to summarize the texts.
A local document summarization tool built with FastAPI and Hugging Face's BART model. The language is preferably English but I also used it for a Farsi text and the result was neither promising nor that bad.
- Upload or paste text content
- Summarize using Abstractive or Extractive methods
- Three length options: Short, Medium, Detailed
- Supports
.pdf,.docx,.txt, and.mdfiles - Detects and uses GPU if available
- Python 3.10+
- Git
- Windows (for
.batlauncher) or any platform for manual run
git clone https://github.com/H0sseini/TextSummarizer.git
cd TextSummarizer
python -m venv venv
venv\Scripts\activate # On Windows
pip install -r requirements.txt
Place the required BART model files in the following folder:
./app/models/bart-large-cnn/
If files are missing or you prefer the app handles the download, the backend will automatically download necessary files and put them in the above folder.
Double-click the run_app.bat and a webpage will be opened that loads the app after a while for you.
From the project directory:
uvicorn frontend.app:app --reload
Or if uvicorn's path is not added:
python -m uvicorn frontend.app:app --reload
Then open your browser and go to:
http://127.0.0.1:8000
- Choose a file or paste text into the box.
- Select summary type and length.
- Press Summarize.
- Copy result with the Copy to Clipboard button.
- Model files (e.g.,
model.safetensors) are excluded from Git. - GPU support is automatic.
- Extractive summarization uses
sumy(LexRank).
This project is licensed under the MIT License. See LICENSE file for details.
📖 The summarization is better done when the input text is around 10,000 words.
The model may take some time when using the CPU, so it is highly recommended to use a GPU, if available.
Of course, it is worth noting the AI model makes mistakes so, don’t rely solely on it.
Have fun! 🚀