Metadata-Version: 2.1
Name: teachable-machine
Version: 1.1
Summary: A Python package to simplify the deployment process of exported Teachable Machine models into Python projects.
Home-page: https://github.com/MeqdadDev/teachable-machine
Download-URL: https://github.com/MeqdadDev/teachable-machine
Author: Meqdad Dev (Meqdad Darwish)
Author-email: meqdad.darweesh@gmail.com
Keywords: python,teachable machine,ai,computer vision,camera,opencv,image classification
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering :: Image Processing
Classifier: Topic :: Scientific/Engineering :: Image Recognition
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (>=1.23.5)
Requires-Dist: Pillow (>=9.4.0)
Requires-Dist: tensorflow (>=2.12.0rc0)

# Teachable Machine

[![Downloads](https://static.pepy.tech/badge/teachable-machine)](https://pepy.tech/project/teachable-machine)
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)

A Python package to simplify the deployment process of exported [Teachable Machine](https://teachablemachine.withgoogle.com/) models into Python projects.

Developed by [@MeqdadDev](https://www.github.com/MeqdadDev)

## Supported Classifiers

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

## Requirements

``` Python >= 3.7 ```

## How to install package

```bash
pip install teachable-machine
```

## Dependencies

```bash
numpy
Pillow
tensorflow
```

## Example

An example for teachable machine package with OpenCV:

```python
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](https://pypi.org/project/teachable-machine/)

[Source Code](https://github.com/MeqdadDev/teachable-machine)
