Skip to content

Devscale-Indonesia/ocr-embeddings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OCR and Embeddings Learning App

This repository is a learning project for Devscale AI-Enabled Python Batch IV. It demonstrates a simple OCR and embeddings workflow using Python, Mistral OCR, and ChromaDB.

What This Project Does

  • Reads employee-handbook.pdf
  • Sends the PDF to Mistral OCR
  • Saves each OCR page as Markdown in ocr-output/
  • Stores OCR text in a local ChromaDB collection
  • Runs a semantic query against the stored document text

Tech Stack

  • Python 3.13+
  • Mistral AI OCR
  • ChromaDB
  • python-dotenv
  • uv

Project Structure

.
├── app/
│   ├── main.py      # Query OCR text from ChromaDB
│   ├── ocr.py       # Run OCR and store page text embeddings
│   └── utils.py     # Shared Mistral and Chroma clients
├── chroma_db/       # Local ChromaDB persistence
├── ocr-output/      # OCR Markdown output per page
├── employee-handbook.pdf
├── pyproject.toml
└── uv.lock

Setup

Install dependencies:

uv sync

Create a .env file:

MISTRALAI_API_KEY=your_mistral_api_key

Usage

Run OCR and save the output into ChromaDB:

uv run python -m app.ocr

Query the embedded OCR content:

uv run python -m app.main

The current sample query asks:

What is the paternity leave policy

You can edit app/main.py to try different questions.

Learning Goals

This project is intended to help learners understand:

  • How OCR turns PDF documents into machine-readable text
  • How document text can be split and stored for retrieval
  • How embeddings make semantic search possible
  • How a local vector database can support document question answering

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages