A simple credit card OCR demo built with Python, Streamlit, and Azure Cognitive Services. This application uploads an image to Azure Blob Storage and extracts text using Azure Document Intelligence (OCR).
- Upload images via browser
- Store files securely in Azure Blob Storage
- Perform OCR using Azure Document Intelligence (
prebuilt-read) - Extract structured text data from images
- Clean project structure with modular services
- Environment variables support with
.env
| Component | Technology |
|---|---|
| Frontend | Streamlit |
| OCR AI | Azure Document Intelligence |
| Storage | Azure Blob Storage |
| Runtime | Python 3.10+ |
| Config | python-dotenv |
.
├── src
│ ├── app.py # Streamlit frontend
│ ├── services
│ │ ├── blob_service.py # Upload to Azure Blob
│ │ └── credit_card_service.py # OCR logic
│ └── utils
│ └── Config.py # Env config loader
├── .env # Azure credentials (not committed)
├── requirements.txt # Python dependencies
└── README.md
git clone https://github.com/yourusername/azure-intelligent-document-ocr.git
cd azure-intelligent-document-ocrpython -m venv venv# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root with:
ENDPOINT=https://<your-azure-endpoint>.cognitiveservices.azure.com/
SUBSCRIPTION_KEY=<your-azure-subscription-key>
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=...
CONTAINER_NAME=cartoes
From the root folder:
streamlit run src/app.pyThe app will open at: http://localhost:8501
- Python 3.10+
- Azure subscription
- Azure Document Intelligence Resource
- Azure Storage Account + Blob Container
- Do not commit your
.envfile - Azure keys must remain secret
- Use this demo for educational purposes only
- Extract cardholder name automatically
- Extract bank/logo using regex and AI
- Generate structured JSON OCR output
- Add Azure Form Recognizer
prebuilt-layoutmodel
This project is licensed under the MIT License.
Pull requests are welcome. For major changes, please open an issue first to discuss.
Developed by Daniel Raid