A Python package to simplify the deployment process of exported Teachable Machine models into Python projects.
Project description
Teachable Machine
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:
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)
Built Distribution
Close
Hashes for teachable_machine-1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f677fe80c257c20a0d35473183780c0ef2e301426f9dab05631012781037c8 |
|
MD5 | 5b5af8343a20cfd8376216e3bd3cb864 |
|
BLAKE2b-256 | c961cb2abd49c3ad8849e01220b0901605873e5d0dc5054a1f418c694b578de6 |