A Flask web application that converts images containing mathematical equations to LaTeX format using the MathPix API.
🚀 Automatic Setup & Run (Recommended):
# Linux/macOS
./run
# Windows
run.batThe script will automatically:
- Create virtual environment
- Install dependencies
- Set up environment variables
- Run the application
-
Clone the repository
git clone <your-repo-url> cd images
-
Create and activate virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
cp .env.example .env
Then edit
.envand add your MathPix API credentials:- Get your API credentials from MathPix
- Add your
MATHPIX_APP_IDandMATHPIX_APP_KEY
-
Run the application
python app.py
- Never commit your
.envfile to version control - The
.envfile contains sensitive API credentials - Use
.env.exampleas a template for others - Keep your API keys secure and rotate them regularly
- Open your browser and go to
http://localhost:5000 - Upload an image containing mathematical equations using one of these methods:
- Drag & Drop: Simply drag an image file onto the upload area
- Click to Browse: Click the upload area or "Choose File" button to select an image
- The app will automatically detect math content and return the LaTeX representation
- Copy the results using the convenient copy buttons:
- Copy raw LaTeX code
- Copy LaTeX with
$$tags for direct use - Copy plain text if no math is detected
- 🎯 Drag & Drop Upload - Simply drag images onto the upload area
- 📋 One-Click Copy - Copy LaTeX with or without formatting tags
- 🎨 Modern UI - Clean, responsive interface with visual feedback
- 🔍 Smart Detection - Separates mathematical LaTeX from plain text
- 🛡️ File Validation - Supports PNG, JPG, JPEG, GIF, BMP, WebP (up to 10MB)
- ⚡ Real-time Feedback - Visual indicators for drag, drop, and copy operations
├── app.py # Main Flask application
├── templates/
│ └── index.html # HTML template
├── .env.example # Environment variables template
├── .env # Your actual API credentials (not in git)
├── requirements.txt # Python dependencies
└── README.md # This file