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.0.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

teachable_machine-1.2.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: teachable_machine-1.2.0.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.0.1.tar.gz
Algorithm Hash digest
SHA256 c190063498b4cf2b2213e9413b46f67fd6f5a3ed58d5f0067bf9c30d72fbdfaa
MD5 83a9e080a816b291ba56bd34fb73f9b9
BLAKE2b-256 208dc2fb1e50385a26c957832f3e80ec5e41ebee1e953444f14c608bf1bd8d05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for teachable_machine-1.2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3707e54f9e53a992356520bdd8d71047c61d4ee805314e89972f9ee7fdbe7047
MD5 9d607753a6b83bc4d4b6d3d4e78c2f46
BLAKE2b-256 a10285ccc231c6561240db48e9c88c43e289bbbcda6ca5895ec17d822a8ac81a

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