Instructions to use Totmaat/howest-hf-ai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Totmaat/howest-hf-ai with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Totmaat/howest-hf-ai") - Notebooks
- Google Colab
- Kaggle
Animal classifier (cat / dog / panda)
Small CNN trained in an Azure Machine Learning pipeline for the Howest MLOps course (lab 1.3).
Input is a 64x64 RGB image, output is a softmax over [cat, dog, panda].
Preprocessing contract
See contract.json. Resize to 64x64 with PIL bicubic resampling, convert to RGB, keep uint8 0-255 values.
Do not divide by 255: training used raw pixels and the model has no rescaling layer.
Usage
import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import keras, numpy as np
from PIL import Image
model = keras.saving.load_model("hf://Totmaat/howest-hf-ai")
x = np.array(Image.open("panda.jpg").convert("RGB").resize((64, 64), Image.Resampling.BICUBIC))[None]
print(["cat", "dog", "panda"][model.predict(x).argmax()])
Quality
5 epochs, 1800 training images, 600 test images. Test accuracy 61.7%. Cats and dogs get mixed up a lot; pandas are recognised well.
- Downloads last month
- 17