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
File size: 436 Bytes
6867877 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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
|