Instructions to use CapstoneML/Model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use CapstoneML/Model 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://CapstoneML/Model") - Notebooks
- Google Colab
- Kaggle
Download Model_Load.py from CapstoneML/Model: direct link, hf CLI and curl.
- Browser
- Download file 436 Bytes
-
https://huggingface.co/CapstoneML/Model/resolve/9474ecb0b28fbc25add165cf70a31a3d58da2612/Model_Load.py
- Command line
-
hf download hf://CapstoneML/Model@9474ecb0b28fbc25add165cf70a31a3d58da2612/Model_Load.py
-
curl -L -o Model_Load.py https://huggingface.co/CapstoneML/Model/resolve/9474ecb0b28fbc25add165cf70a31a3d58da2612/Model_Load.py
436 Bytes
| import keras | |
| from keras.models import model_from_json | |
| print("keras versio:", keras.__version__) | |
| def load_model_from_files(json_path, weights_path): | |
| with open(json_path, "r") as json_file: | |
| loaded_model_json = json_file.read() | |
| model = model_from_json(loaded_model_json) | |
| model.load_weights(weights_path) | |
| model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy']) | |
| return model | |