AI-powered license plate recognition for EU/Balkan vehicles, built with OpenAI Vision.
Mini License Reader is a Streamlit web application that reads license plates and country codes from uploaded vehicle images using the OpenAI Vision API. It was built for a logistics/warehouse access-control use case where vehicles arriving on site need their plates identified quickly and consistently, including plates from countries (Bulgaria, Hungary, Slovakia, North Macedonia, Serbia, Romania, Turkey, Ukraine and more) that are easy to confuse.
The app uploads one or more images, sends them to a vision-capable model with a carefully engineered prompt, validates the structured JSON response, and returns the country code and plate number. A lightweight in-memory cache and request rate-limiting keep API usage efficient.
- Upload and process one or many images at once (JPG, JPEG, PNG, JFIF)
- Vision-based plate and country-code extraction via the OpenAI API
- Two selectable prompt strategies: a detailed rule-based prompt (with country-specific disambiguation rules) and a simple prompt
- Strict JSON response validation against a whitelist of valid EU/Balkan country codes
- Flash/glare detection on uploaded images to flag unreadable scans
- In-memory caching with a configurable lifetime and max size
- Per-request rate limiting to control API throughput
- Side-by-side UI showing the image and the analysis result
- Language: Python 3.11
- UI: Streamlit
- AI/Vision: OpenAI API (vision-capable chat completions)
- Image processing: Pillow, NumPy
- Config: python-dotenv
- Deployment: Render (
render.yaml)
- Clone the repository.
- Copy
.env.exampleto.envand add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here PROMPT_TEMPLATE=your_prompt_template_here - Install dependencies:
pip install -r requirements.txt
- Run the app:
streamlit run app-mini.py
app-mini.pytargets the latest vision model;app-mini-4.pyis an earlier GPT-4o-mini variant kept for reference.
Usama Bin Ejaz — AI/ML Engineer | Data Scientist | Founder, UBE Labs ("AI that ships.")
- GitHub: github.com/ube09
- Website: usamabinejaz.com