From 237887650047ba0e65080706d433e77e0bded942 Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Sat, 29 Mar 2025 06:30:47 +0100 Subject: [PATCH] Add script to generate Lens bindings --- README.md | 2 +- generate_lens_bindings.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 generate_lens_bindings.sh diff --git a/README.md b/README.md index 1f3377d..c4a219b 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Additionally: - WinRT OCR: this will work on Windows 10 or later if winocr (`pip install winocr`) is installed. It can also be used by installing winocr on a Windows virtual machine and running the server there (`winocr_serve`), and installing requests (`pip install requests`) and specifying the IP address of the Windows VM/machine in the config file ("w" key) ## Cloud providers -- Google Lens: Google Vision in disguise (no need for API keys!), You need to install protobuf and requests (`pip install protobuf requests`) ("l" key) +- Google Lens: Google Vision in disguise (no need for API keys!), you need to install protobuf and requests (`pip install protobuf requests`) ("l" key) - Google Lens (web): alternative version of Lens (Google webpage version). Results should be the same but it's much slower. You need to install pyjson5 and requests (`pip install pyjson5 requests`) ("k" key) - Google Vision: you need a service account .json file named google_vision.json in `user directory/.config/` and installing google-cloud-vision (`pip install google-cloud-vision`) ("g" key) - Azure Image Analysis: you need to specify an api key and an endpoint in the config file and to install azure-ai-vision-imageanalysis (`pip install azure-ai-vision-imageanalysis`) ("v" key) diff --git a/generate_lens_bindings.sh b/generate_lens_bindings.sh new file mode 100755 index 0000000..2b75534 --- /dev/null +++ b/generate_lens_bindings.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +PROTO_PATH="$1" + +mkdir -p owocr/py_lens +protoc "--proto_path=$PROTO_PATH" --python_out=owocr/py_lens $PROTO_PATH/*.proto +sed -i '' "s/import lens_overlay/import owocr.py_lens.lens_overlay/" py_lens/* \ No newline at end of file