Skip to content

andriansandi/AI-OCR

Repository files navigation

Cloudflare Workers — Simple OCR Number Extractor

This Cloudflare Worker receives an uploaded image, processes it using Cloudflare AI (LLaVA model), and extracts all numbers detected in the image.
It returns the primary numeric value as distance.

Useful for reading numbers from running watches, timers, digital meters, dashboards, and similar visual displays.


🚀 Features

  • Accepts image uploads via multipart/form-data
  • Uses Cloudflare AI model: @cf/llava-hf/llava-1.5-7b-hf
  • Extracts only numbers from the image
  • Returns a clean numeric JSON result:
    { "distance": 5.35 }

📦 Endpoint

POST /
Content-Type: multipart/form-data

Required field

  • file → JPG/PNG image

🧪 Example Requests

📌 Postman

  • Method: POST
  • Body: form-data
    • Key: file
    • Type: File
    • Value: Select your image

📌 cURL

curl -X POST \
  -F "file=@/path/to/image.jpg" \
  https://your-worker-url.workers.dev

📥 Example Response

{
  "distance": 5.35
}

If no number is detected:

{
  "distance": null
}

Maintainers

About

AI OCR using Cloudflare AI (LLaVA model)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors