{"id":25976853,"url":"https://github.com/theognis1002/ocr-restaurant-menu-import","last_synced_at":"2026-06-11T09:31:32.860Z","repository":{"id":252289619,"uuid":"839993338","full_name":"theognis1002/ocr-restaurant-menu-import","owner":"theognis1002","description":"Simple OCR restaurant menu import script","archived":false,"fork":false,"pushed_at":"2025-02-06T18:12:23.000Z","size":6520,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T04:32:04.253Z","etag":null,"topics":["machine-learning","multiprocessing","ocr","precommit","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theognis1002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-08T18:35:15.000Z","updated_at":"2024-11-25T20:06:23.000Z","dependencies_parsed_at":"2025-03-05T04:39:37.080Z","dependency_job_id":null,"html_url":"https://github.com/theognis1002/ocr-restaurant-menu-import","commit_stats":null,"previous_names":["theognis1002/ocr-restaurant-menu-import"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/theognis1002/ocr-restaurant-menu-import","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theognis1002%2Focr-restaurant-menu-import","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theognis1002%2Focr-restaurant-menu-import/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theognis1002%2Focr-restaurant-menu-import/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theognis1002%2Focr-restaurant-menu-import/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theognis1002","download_url":"https://codeload.github.com/theognis1002/ocr-restaurant-menu-import/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theognis1002%2Focr-restaurant-menu-import/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34192870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","multiprocessing","ocr","precommit","python3"],"created_at":"2025-03-05T04:29:25.187Z","updated_at":"2026-06-11T09:31:32.841Z","avatar_url":"https://github.com/theognis1002.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OCR Image Menu Text Extractor\n\n## Overview\n\n![Restaurant Menu Image](https://github.com/theognis1002/ocr-restaurant-menu-import/blob/main/images/IMG_6527.jpg?raw=true)\n\nThis script extracts text from images of restaurant menus using Optical Character Recognition (OCR) and then enhances and structures the extracted text using a language model. The script processes images in a specified directory and outputs the structured data to a JSON file.\n\n## Features\n\n- **OCR Extraction**: Uses `pytesseract` to extract text from images.\n- **Text Enhancement**: Utilizes a language model (`litellm`) to convert raw text into structured JSON.\n- **Multiprocessing**: Processes multiple images in parallel to improve performance.\n- **Supports Multiple Formats**: Handles various image formats such as JPEG, PNG, BMP, and TIFF.\n\n## Requirements\n\n- Python 3.12\n- `pytesseract`\n- `Pillow` (PIL)\n- `litellm`\n- `multiprocessing` (part of Python standard library)\n\nYou can install the required Python packages using pip:\n\n```bash\npip install -r requirements.txt\n```\n\n## Configuration\n\n- `IMAGES_DIR`: Directory where the images are located (default: `images/`).\n- `OUTPUT_FILE`: File where the structured JSON data will be saved (default: `output.json`).\n\n## Usage\n\n1. Place the script in your desired directory.\n2. Ensure your images are located in the directory specified by `IMAGES_DIR`.\n3. `pip install -r requirements.txt`\n4. `python main.py`\n\n## Script Details\n\n### Functions\n\n- `extract_text(image_path: str) -\u003e str`: Extracts text from the specified image using OCR.\n- `enhance_and_jsonify_text(raw_text: str) -\u003e dict`: Enhances raw text and converts it into structured JSON using a language model.\n- `process_image(image_file: Path) -\u003e dict`: Processes a single image file and returns the result as a dictionary.\n- `process_images_from_directory(directory_path: str) -\u003e dict`: Processes all images in the given directory using multiprocessing.\n- `main(directory_path: str, output_file: str) -\u003e None`: Main function to process images and write results to a JSON file.\n\n## 📜 License\n\nDistributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheognis1002%2Focr-restaurant-menu-import","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheognis1002%2Focr-restaurant-menu-import","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheognis1002%2Focr-restaurant-menu-import/lists"}