Instructions to use FredZhang7/google-safesearch-mini-tfjs with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TF-Keras
How to use FredZhang7/google-safesearch-mini-tfjs with TF-Keras:
# Note: 'keras<3.x' or 'tf_keras' must be installed (legacy) # See https://github.com/keras-team/tf-keras for more details. from huggingface_hub import from_pretrained_keras model = from_pretrained_keras("FredZhang7/google-safesearch-mini-tfjs") - Notebooks
- Google Colab
- Kaggle
Commit ·
2a32736
1
Parent(s): eaacc51
Upload model
Browse files- Model.py +4 -0
- config.json +1 -1
Model.py
CHANGED
|
@@ -110,6 +110,10 @@ class InceptionV3ModelForImageClassification(PreTrainedModel):
|
|
| 110 |
self.eval()
|
| 111 |
if device == "cuda":
|
| 112 |
image = image.cuda()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
with torch.no_grad():
|
| 114 |
out, aux = self(image)
|
| 115 |
print(out)
|
|
|
|
| 110 |
self.eval()
|
| 111 |
if device == "cuda":
|
| 112 |
image = image.cuda()
|
| 113 |
+
self.cuda()
|
| 114 |
+
else:
|
| 115 |
+
image = image.cpu()
|
| 116 |
+
self.cpu()
|
| 117 |
with torch.no_grad():
|
| 118 |
out, aux = self(image)
|
| 119 |
print(out)
|
config.json
CHANGED
|
@@ -43,6 +43,6 @@
|
|
| 43 |
0.5
|
| 44 |
],
|
| 45 |
"torch_dtype": "float32",
|
| 46 |
-
"transformers_version": "4.
|
| 47 |
"use_jit": true
|
| 48 |
}
|
|
|
|
| 43 |
0.5
|
| 44 |
],
|
| 45 |
"torch_dtype": "float32",
|
| 46 |
+
"transformers_version": "4.25.1",
|
| 47 |
"use_jit": true
|
| 48 |
}
|