Skip to content

Repository files navigation

notes-2-LaTeX

Convert images of mathematical notes and equations into clean LaTeX with a Streamlit interface powered by OpenAI vision.

Live app: https://notes-2-latex.streamlit.app/

Features

  • Upload .png, .jpg, or .jpeg images.
  • Extract only mathematical formulas as LaTeX.
  • Convert a complete photographed page into a compilable .tex document.
  • Preview and copy generated LaTeX from the Streamlit UI.
  • Download full-document output for use in Overleaf or another LaTeX editor.
  • Uses gpt-4o-mini for image understanding.

Included apps

  • Foto2LaTeX (dual: FÓRMULAS o DOCUMENTO completo).py — recommended version with formula-only and full-document modes.
  • Foto2LaTeX (solo FÓRMULAS → LaTeX).py — lightweight formula-only version.

Requirements

  • Python 3.10+
  • Streamlit
  • OpenAI Python SDK
  • Pillow
  • An OpenAI API key

Install dependencies:

pip install -r requirements.txt

Configuration

Set your API key as an environment variable:

export OPENAI_API_KEY="your-key"

On Windows PowerShell:

$env:OPENAI_API_KEY="your-key"

For Streamlit Cloud, store the key in the app secrets as OPENAI_API_KEY.

Never commit API keys to the repository.

Run locally

Clone the project:

git clone https://github.com/MarioIbago/notes-2-LaTeX.git
cd notes-2-LaTeX
pip install -r requirements.txt

Run the dual-mode app:

streamlit run "Foto2LaTeX (dual: FÓRMULAS o DOCUMENTO completo).py"

Or run the formula-only version:

streamlit run "Foto2LaTeX (solo FÓRMULAS → LaTeX).py"

How it works

  1. The uploaded image is normalized and encoded for the vision request.
  2. The selected mode asks the model either for raw equation LaTeX or for a complete compilable document.
  3. The response is returned to the Streamlit interface for preview, copy, or download.

License

See LICENSE.

About

👁️ Foto2LaTeX — Sube una foto con una ecuación y la app te la convierte directo a código LaTeX usando GPT-4o-mini. Puedes ver la ecuación renderizada, copiar solo el código o bajar un .tex listo para compilar en Overleaf. Todo rápido, simple y con interfaz hecha en Streamlit.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages