Skip to main content

A Python package designed to simplify the integration of exported models from Google's Teachable Machine platform into various environments. This tool was specifically crafted to work seamlessly with Teachable Machine, making it easier to implement and use your trained models.

Project description

Teachable Machine

By: Meqdad Darwish

Teachable Machine Package Logo

Downloads MIT License PyPI

A Python package designed to simplify the integration of exported models from Google's Teachable Machine platform into various environments. This tool was specifically crafted to work seamlessly with Teachable Machine, making it easier to implement and use your trained models.

Source Code is published on GitHub

Read more about the project (requirements, installation, examples and more) in the Documentation Website

Supported Classifiers

Image Classification: use exported keras model from Teachable Machine platform.

Requirements

Python >= 3.7

How to install package

pip install teachable-machine

Example

An example for teachable machine package with OpenCV:

from teachable_machine import TeachableMachine
import cv2 as cv

cap = cv.VideoCapture(0)
model = TeachableMachine(model_path="keras_model.h5",
                         labels_file_path="labels.txt")

image_path = "screenshot.jpg"

while True:
    _, img = cap.read()
    cv.imwrite(image_path, img)

    result, resultImage = model.classify_and_show(image_path)

    print("class_index", result["class_index"])

    print("class_name:::", result["class_name"])

    print("class_confidence:", result["class_confidence"])

    print("predictions:", result["predictions"])

    cv.imshow("Video Stream", resultImage)

    k = cv.waitKey(1)
    if k == 27:  # Press ESC to close the camera view
        break
    
cap.release()
cv.destroyAllWindows()

Values of result are assigned based on the content of labels.txt file.

For more; take a look on these examples

Links:

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

teachable_machine-1.2.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

teachable_machine-1.2.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file teachable_machine-1.2.1.tar.gz.

File metadata

  • Download URL: teachable_machine-1.2.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for teachable_machine-1.2.1.tar.gz
Algorithm Hash digest
SHA256 d6f7b6cdfe3a65320195b21408352f265d7ea282b7d6824c5030d8d63e89fae0
MD5 462fcf4f14b237445ee08ab9faa443de
BLAKE2b-256 0cdb94c7545f0ef8f8a3d10781df06a653fabb2cb8e9b7c19af77cc64d78bb2e

See more details on using hashes here.

File details

Details for the file teachable_machine-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for teachable_machine-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 039d9978f5df7078180d7ab6c56c2659a6037251ad16b9f003ce72914bec70cf
MD5 145e5059c56c9d439e56fceee5234a83
BLAKE2b-256 8ea3d6a4ba57b80596fb950b20ee7549979128ceb2411cd94674a1332a18ac88

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