mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-06 19:25:24 +00:00
OCR Plugin
This is a README file for the OCR plugin. This plugin uses the RapidOCR
library to perform OCR (Optical Character Recognition) on image files and updates the metadata of the entity with the OCR results.
How to Run
To run this OCR plugin, follow the steps below:
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the FastAPI application:
You can run the FastAPI application using
uvicorn
. Make sure you are in the directory wheremain.py
is located.uvicorn main:app --host 0.0.0.0 --port 8000
-
Integration with memos:
$ python -m memos.commands plugin create ocr http://localhost:8000 Plugin created successfully
$ python -m memos.commands plugin ls ID Name Description Webhook URL 1 ocr http://localhost:8000/
$ python -m memos.commands plugin bind --lib 1 --plugin 1 Plugin bound to library successfully
Endpoints
GET /
: Health check endpoint. Returns{"healthy": True}
if the service is running.POST /
: OCR endpoint. Accepts anEntity
object and aLocation
header. Performs OCR on the image file and updates the entity's metadata with the OCR results.
Metadata
The OCR results are stored in the metadata field named ocr_result
with the following structure: