Skip to main content

Model to automatize the separation of a messy PDF into multiple documents for the Brazilian Federal Supreme Court.

Project description

Splitter

How to install or update the lib

# The .h5 models are installed along with the pip installation. 
    # There's no need to hardcode their path anywhere.
pip install git+https://gitlab.com/gpam/victor/SERVICES/splitter.git
# Or
pip install victor-services-splitter 

How to uninstall the lib

pip uninstall victor-services-splitter

How to generate predictions

from splitter.model import ModelSplitter

# Setup the threading of the TensorFlow model operations
# (...)

model_splitter = ModelSplitter("path/to/model/page/image/features",
                               "path/to/model/page/classification")

# Create the image list. See the supported image types section
image_list = [...]


prediction_list = model_splitter.predict_pdf_pages(
    image_list
    )
# [1, 0, 0, 1, 1, 1, 0]

grouped_prediction_list = model_splitter.predict_pdf_pages(
    image_list,
    has_to_group_predictions=True
    )
# [[1, 0, 0], [1], [1], [1, 0]]

precise_prediction_list = model_splitter.predict_pdf_pages(
    image_list,
    prediction_decimals=3
    )
# [1.0, 0.312, 0.0, 0.963, 0.534, 0.744, 0.23]

Setup the threading of the TensorFlow model operations.

Read more at the TensorFlow docs about threading.

import tensorflow as tf

# a value of 0 means the system picks an appropriate number.
tf.config.threading.set_intra_op_parallelism_threads(
    num_threads=0
    )

# a value of 0 means the system picks an appropriate number.
tf.config.threading.set_inter_op_parallelism_threads(
    num_threads=0
    )

Supported image types

- Pillow
- Base64
- Bytes
- Image path ending with '.jpg', '.png' or '.jpeg'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

victor-services-splitter-0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file victor-services-splitter-0.1.1.tar.gz.

File metadata

  • Download URL: victor-services-splitter-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for victor-services-splitter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5bfb2c0c831a383bb5c2f6b55d520235ba0b55340428f0b977d6a2201ecfdbf
MD5 3c82d34389055173a6db70a4b4065b9d
BLAKE2b-256 3ca30be143c769eaeb49afe876a7f38f06b4ec6c5d28e8c397f7046e216b8c7e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page