Instructions to use AiresPucrs/model-api with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use AiresPucrs/model-api with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://AiresPucrs/model-api") - Notebooks
- Google Colab
- Kaggle
| license: apache-2.0 | |
| library_name: keras | |
| # Model API (Teeny-Tiny Castle) | |
| This model is part of a tutorial tied to the [Teeny-Tiny Castle](https://github.com/Nkluge-correa/TeenyTinyCastle), an open-source repository containing educational tools for AI Ethics and Safety research. | |
| ## How to Use | |
| ```python | |
| import json | |
| import tensorflow as tf | |
| from huggingface_hub import hf_hub_download | |
| # Download the model (this will be the target of our attack) | |
| hf_hub_download(repo_id="AiresPucrs/model-api", | |
| filename="model_api.h5", | |
| local_dir="./", | |
| repo_type="model" | |
| ) | |
| # Download the tokenizer file | |
| hf_hub_download(repo_id="AiresPucrs/model-api", | |
| filename="tokenizer_model_api.json", | |
| local_dir="./", | |
| repo_type="model" | |
| ) | |
| model_api = tf.keras.models.load_model('./model_api.h5') | |
| with open('./tokenizer_model_api.json') as fp: | |
| data = json.load(fp) | |
| tokenizer = tf.keras.preprocessing.text.tokenizer_from_json(data) | |
| fp.close() | |
| ``` |