This project extracts text from an image using Tesseract OCR and summarizes the extracted text using Hugging Face Transformers.
It combines:
- Optical Character Recognition (OCR)
- Natural Language Processing (NLP)
- Transformer-based summarization models
Make sure Python 3.8 or higher is installed.
Check version:
python --versionIf not installed, download from: https://www.python.org/downloads/
git clone https://github.com/your-username/image-text-summarizer.git
cd image-text-summarizerpip install pytesseract pillow transformers torch(Optional) Create a virtual environment:
python -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # Linux/macOSThis project requires Tesseract OCR installed separately.
- Download from: https://github.com/tesseract-ocr/tesseract
- Install it.
- If needed, set path in your script:
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'sudo apt update
sudo apt install tesseract-ocrbrew install tesseractPlace your image file inside the project folder.
Example:
project-folder/
│
├── image_summary.py
├── sample.png
Open image_summary.py and update:
image = Image.open("sample.png")Make sure the filename matches your image.
python image_summary.pyThe script will:
- Extract text from the image.
- Print extracted text.
- Generate summarized text.
- Print the final summary.
- Image is loaded using Pillow.
- Text is extracted using Tesseract OCR.
- Extracted text is passed to Hugging Face summarization pipeline.
- Transformer model generates a concise summary.
Make sure:
- Tesseract is installed
- Path is correctly set (Windows users)
The first run may take longer because the transformer model downloads automatically.
You can create a requirements.txt file with:
pytesseract
pillow
transformers
torch
Install using:
pip install -r requirements.txtYour Name
Computer Science Student
Interested in AI, NLP, and Automation
⭐ If you like this project, give it a star on GitHub!