Skip to main content

Helper library for interacting with Landing AI LandingLens

Project description

LandingLens code sample repository

This repository contains LandingLens development library and running examples showing how to integrate LandingLens on a variety of scenarios. All the examples show different ways to acquire images from multiple sources and techniques to process the results. Jupyter notebooks focus on ease of use while Python apps include more robust and complete examples.

example description language
Company logo identification This notebook can run directly in Google collab using the web browser camera to detect Landing AI logo Jupyter Notebook Colab
Door monitoring for home automation This notebook uses an object detection model to determine whether a door is open or closed. The notebook can acquire images directly from an RTSP camera Jupyter Notebook
Streaming capture service This application shows how to do continuous acquisition from an image sensor using RTSP. Python application

Install the library

pip install landingai

Quick Start

Run inference using your deployed inference endpoint at LandingAI:

  • Install the library with the above command.
  • Create a Predictor with your inference endpoint id, landing API key and secret.
  • Call predict() with an image (in numpy array format).
from landingai.predict import Predictor
# Find your API key and secrets
endpoint_id = "FILL_YOUR_INFERENCE_ENDPOINT_ID"
api_key = "FILL_YOUR_API_KEY"
api_secret = "FILL_YOUR_API_SECRET"
# Load your image
image = ...
# Run inference
predictor = Predictor(endpoint_id, api_key, api_secret)
predictions = predictor.predict(image)

Visualize your inference results by overlaying the predictions on the input image and save it on disk:

from landingai.visualize import overlay_predictions
# continue the above example
predictions = predictor.predict(image)
image_with_preds = overlay_predictions(predictions, image)
image_with_preds.save("image.jpg")

Running examples locally

All the examples in this repo can be run locally.

Here is an example to show you how to run the rtsp-capture example locally in a shell environment:

NOTE: it's recommended to create a new Python virtual environment first.

  1. Clone the repo to local: git clone https://github.com/landing-ai/landingai-python-v1.git
  2. Install the library: pip install landingai
  3. Run: python landingai-python-v1/examples/capture-service/run.py

Building the LandingLens library locally (for contributors)

Most of the time you won't need to build the library since it is included on this repository and also published to pypi.

But if you want to contribute to the repo, you can follow the below steps.

Prerequisite - Install poetry

landingai uses Poetry for packaging and dependency management. If you want to build it from source, you have to install Poetry first. Please follow the official guide to see all possible options.

For Linux, macOS, Windows (WSL):

curl -sSL https://install.python-poetry.org | python3 -

NOTE: you can switch to use a different Python version by specifying the python version:

curl -sSL https://install.python-poetry.org | python3.10 -

or run below command after you have installed poetry:

poetry env use 3.10

Install all the dependencies

poetry install --with dev

Run tests

poetry run pytest tests/

Activate the virtualenv

poetry shell

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

landingai-0.0.10.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

landingai-0.0.10-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file landingai-0.0.10.tar.gz.

File metadata

  • Download URL: landingai-0.0.10.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Darwin/21.1.0

File hashes

Hashes for landingai-0.0.10.tar.gz
Algorithm Hash digest
SHA256 62ce0189ac571b43c7ecbdb0b08634e3c4d50abbaa3be76c969f94d587ce310c
MD5 c1c9d3a5807696221d120ddc9d1663f2
BLAKE2b-256 0bc573f135d1e08db5b93f57828700857bcfce2fcaed39ae88e943e9b4196fae

See more details on using hashes here.

File details

Details for the file landingai-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: landingai-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.11 Darwin/21.1.0

File hashes

Hashes for landingai-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 884d41f5ed5786d11d5bb2dd665d1b563232c30b8b08d6251ddfbab6c7c130d2
MD5 2bfbefaa3172b42de1a1c44a21623b4a
BLAKE2b-256 652a78822e5a15bc1f2512dcc9dde54b6b942ce2f5a9c12d10e5ed6930312e7d

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