Keras
nicholasKluge commited on
Commit
2cd9af9
·
verified ·
1 Parent(s): a03376a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -0
README.md CHANGED
@@ -1,3 +1,36 @@
1
  ---
2
  license: apache-2.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ library_name: keras
4
  ---
5
+ # Model API (Teeny-Tiny Castle)
6
+
7
+ 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.
8
+
9
+ ## How to Use
10
+
11
+ ```python
12
+ import json
13
+ import tensorflow as tf
14
+ from huggingface_hub import hf_hub_download
15
+
16
+ # Download the model (this will be the target of our attack)
17
+ hf_hub_download(repo_id="AiresPucrs/model-api",
18
+                 filename="model_api.h5",
19
+                 local_dir="./",
20
+                 repo_type="model"
21
+ )
22
+
23
+ # Download the tokenizer file
24
+ hf_hub_download(repo_id="AiresPucrs/model-api",
25
+                 filename="tokenizer_model_api.json",
26
+                 local_dir="./",
27
+                 repo_type="model"
28
+ )
29
+
30
+ model_api = tf.keras.models.load_model('./model_api.h5')
31
+
32
+ with open('./tokenizer_model_api.json') as fp:
33
+ data = json.load(fp)
34
+ tokenizer = tf.keras.preprocessing.text.tokenizer_from_json(data)
35
+ fp.close()
36
+ ```