Skip to main content

Prerequisites

Before installing CoroNet, ensure you have:
  • Python 3.8 or higher installed on your system
  • pip package manager (usually comes with Python)
  • An OpenAI API key with access to GPT-4o models
  • Administrator/sudo privileges for installing Tesseract OCR
CoroNet requires both OpenAI API access and Tesseract OCR to function properly. The application uses a dual-detection approach for maximum reliability.

Installation Steps

1

Clone the Repository

First, clone the CoroNet repository to your local machine:
git clone https://github.com/JordanGonz/TallerMatricula.git
cd TallerMatricula
2

Create Virtual Environment

Create a Python virtual environment to isolate project dependencies:
python3 -m venv venv
source venv/bin/activate
You’ll know the virtual environment is activated when you see (venv) at the beginning of your terminal prompt.
3

Install Python Dependencies

Install all required Python packages from requirements.txt:
pip install -r requirements.txt
This installs the following key dependencies:
  • Flask 3.0.3 - Web framework and routing
  • Jinja2 3.1.6 - Template engine for HTML rendering
  • Werkzeug 3.1.3 - WSGI utilities
  • openai 2.6.1 - OpenAI API client for GPT-4o
  • pytesseract 0.3.13 - Tesseract OCR Python wrapper
  • Pillow 12.0.0 - Image processing library
  • python-dotenv 1.1.1 - Environment variable management
  • requests 2.32.5 - HTTP library
  • Standard library: csv, os, datetime
The complete dependency list is available in requirements.txt with pinned versions for reproducibility.
4

Install Tesseract OCR

Tesseract OCR must be installed separately as it’s a system-level application:
sudo apt update
sudo apt install tesseract-ocr
sudo apt install libtesseract-dev
Verify Tesseract Installation:
tesseract --version
You should see output similar to:
tesseract 5.3.0
 leptonica-1.82.0
Windows Users: After installation, ensure Tesseract is added to your system PATH. The default installation path is typically C:\Program Files\Tesseract-OCR.
5

Configure Environment Variables

Create a .env file in the project root directory with your OpenAI API key:
# .env
OPENAI_API_KEY=sk-your-api-key-here
Getting an OpenAI API Key:
  1. Visit platform.openai.com
  2. Sign up or log in to your account
  3. Navigate to API keys in your account settings
  4. Click Create new secret key
  5. Copy the key and paste it into your .env file
Never commit your .env file to version control. The .gitignore file already includes this for your protection.
CoroNet uses the gpt-4o-mini model by default (see app.py:50), which is cost-effective for license plate detection. A typical request costs less than $0.001.
6

Verify Installation

Test that everything is set up correctly:
python -c "import flask, openai, pytesseract, PIL; print('All imports successful!')"
If you see “All imports successful!”, you’re ready to go!

Project Structure

After installation, your project directory should look like this:
TallerMatricula/
├── app.py                  # Main Flask application
├── requirements.txt        # Python dependencies
├── .env                    # Environment variables (create this)
├── .gitignore             # Git ignore rules
├── README.md              # Project documentation
├── templates/             # HTML templates
│   ├── index.html         # Upload interface
│   └── registros.html     # Records view
├── static/                # Static assets (CSS, JS, images)
├── uploads/               # Uploaded images (auto-created)
└── data/                  # CSV database (auto-created)
    └── registros.csv      # Records storage
The uploads/ and data/ directories are created automatically when you first run the application (see app.py:21-22).

Configuration Details

Flask Configuration

The application uses Flask’s built-in development server with these settings (app.py:11-12):
app = Flask(__name__)
app.secret_key = "superclave"  # Used for flash messages
Production Deployment: Change the secret_key to a random, secure value before deploying to production. Use os.getenv('SECRET_KEY') and set it in your .env file.

Tesseract Configuration

If Tesseract is not in your system PATH, you can specify its location manually in app.py:
import pytesseract

# Windows example
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

# macOS/Linux example
pytesseract.pytesseract.tesseract_cmd = '/usr/local/bin/tesseract'

OpenAI Configuration

The OpenAI client is initialized with your API key (app.py:14-15):
load_dotenv()
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))

Troubleshooting

Problem: Python dependencies not installed or wrong virtual environment.Solution:
# Ensure virtual environment is activated
source venv/bin/activate  # Linux/macOS
.\venv\Scripts\Activate.ps1  # Windows

# Reinstall dependencies
pip install -r requirements.txt
Problem: Tesseract OCR is not installed or not in PATH.Solution:
  • Verify installation: tesseract --version
  • Add Tesseract to PATH or specify location in code (see Configuration Details above)
  • Restart your terminal after installation
Problem: Missing or invalid OpenAI API key.Solution:
  • Verify .env file exists in project root
  • Check key format: should start with sk-
  • Ensure no extra spaces or quotes around the key
  • Test key validity at platform.openai.com/api-keys
Problem: Insufficient permissions to create or write to directories.Solution:
# Linux/macOS
chmod 755 .
mkdir -p uploads data
chmod 755 uploads data

# Or run with appropriate permissions
sudo python app.py  # Not recommended for development

Next Steps

Now that CoroNet is installed, let’s get it running:

Quickstart Tutorial

Follow our step-by-step tutorial to detect your first license plate

Configuration Guide

Learn about advanced configuration options

Build docs developers (and LLMs) love