Skip to content

Commit

Permalink
Merge pull request #3 from MuckRock/main
Browse files Browse the repository at this point in the history
Cost structure, remove debugs
  • Loading branch information
duckduckgrayduck authored Nov 20, 2023
2 parents 9f67ba7 + 3f13b2a commit 737d7bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ title: Google Cloud Vision OCR
description: >-
OCR your documents using Google Cloud Vision OCR.
This Add-On uses 1 AI Credit per page.
instructions: ''
type: object
documents:
- selected
properties: {}
categories:
- extraction
- premium
cost:
amount: 1
unit: document
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,17 @@ def set_doc_text(self, document, blobs_list):

pages.append(page)
except KeyError as e:
print(e)
self.set_message("Key error- ping us at info@documentcloud.org with the document you're trying to OCR")
sys.exit(1)
except ValueError:
self.set_message(
"Value error - Ping us at info@documentcloud.org"
" if you see this more than once."
)
sys.exit(1)

# Set the pages with text and position information to the document
# print(pages) debug
resp = self.client.patch(f"documents/{document.id}/", json={"pages": pages})
# print(resp.status_code) debug
# print(resp.json()) debug

def vision_method(self, document, input_dir, filename):
"""Main method that calls the sub-methods to perform OCR on a doc"""
Expand Down

0 comments on commit 737d7bd

Please sign in to comment.