A FastAPI-based document summarization service that supports both extractive and abstractive summarization. It allows users to upload documents (PDF or text files) and receive summaries based on their preferred summarization approach.
Summify/
├── src/
│ ├── assets/
│ │ └── test_cases/
│ │ ├── nativepdf_ar.pdf
│ │ ├── nativepdf_fr.pdf
│ │ ├── scanned_ar1.pdf
│ │ ├── scanned_ar2.pdf
│ │ ├── scannedpdf_en.pdf
│ │ └── text.txt
│ ├── config/
│ │ ├── __init__.py
│ │ └── settings.py
│ ├── controllers/
│ │ ├── __init__.py
│ │ ├── BaseController.py
│ │ └── SummaryController.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── file_parser.py
│ │ └── summarizer.py
│ ├── helpers/
│ │ ├── enums/
│ │ │ ├── __init__.py
| | | ├── extraction_enums.py
| | | ├── scan_enums.py
| | | ├── summary_enums.py
| | | └── validation_enums.py
│ │ ├── file_validation.py
│ │ ├── lang_detection.py
│ │ ├── scan_checker.py
│ │ └── text_processing.py
│ └── routes/
│ ├── __init__.py
| ├── base.py
│ ├── summary.py
│ └── schemas/
│ ├── __init__.py
│ └── upload_request.py
│
├── .env
├── .env.example
├── .gitignore
├── main.py
├── requirements.txt
├── LICENSE
└── README.md
For Welcome message
Summarize a document (PDF or text file).
- Method:
POST
- Content-Type:
multipart/form-data
- Body:
file
: The document to summarize (PDF or text file).summ_approach
: The summarization approach (abstractive
orextractive
).max_length
: The maximum length of the summary (required forabstractive
).sentences_num
: The maximum sentence count of the summary (required forextractive
).
curl -X POST "http://localhost:8000/data/summary/file" \
-H "Content-Type: multipart/form-data" \
-F "file=@document.pdf" \
-F "summ_approach=abstractive" \
-F "max_length=500"
{
"summary": "generated summary of the document..."
}
Make sure you have Python 3.8< 3.13> installed. Then, install the required dependencies:
pip install -r requirements.txt
Start the FastAPI server:
cd src
python main.py
The API will be available at http://localhost:8000
.
You can use tools like Postman to test the API. Refer to the API Routes section for examples.
- Python 3.8 - 3.12.8
- Pip (Python package manager)
-
Clone the repository:
git clone https://github.com/tawfikhammad/Summify.git cd Summify
-
Set up a virtual environment:
conda create --name summify python=3.12.8 conda activate summify
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
cd src python main.py
If you have any questions, suggestions, or just want to connect, feel free to reach out to me on LinkedIn:
Let’s connect and collaborate!
This project is licensed under the MIT License. See the LICENSE file for details.