Skip to main content

A Python package to simplify the deployment process of exported Teachable Machine models into Python projects.

Project description

Teachable Machine

Downloads MIT License

A Python package to simplify the deployment process of exported Teachable Machine models into Python projects.

Developed by @MeqdadDev

Supported Classifiers

Image Classification: Use exported keras model from Teachable Machine platfrom.

Requirements

Python >= 3.7

How to install package

pip install teachable-machine

Dependencies

numpy
Pillow
tensorflow

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 = model.classify_image(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", img)

    cv.waitKey(1)

class_index and class_name are assigned based on the content of labels.txt file.

Links:

PyPI

Source Code

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.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

teachable_machine-1.1-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

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