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 ·
df6753f
1
Parent(s): f9e2f01
Upload model
Browse files- Model.py +2 -4
- pytorch_model.bin +3 -0
Model.py
CHANGED
|
@@ -10,10 +10,8 @@ class InceptionV3ModelForImageClassification(PreTrainedModel):
|
|
| 10 |
|
| 11 |
if self.config.model_name == "google-safesearch-mini":
|
| 12 |
if not os.path.exists(model_path):
|
| 13 |
-
import
|
| 14 |
-
|
| 15 |
-
r = requests.get(url, allow_redirects=True)
|
| 16 |
-
open(model_path, 'wb').write(r.content)
|
| 17 |
self.model = torch.jit.load(model_path)
|
| 18 |
else:
|
| 19 |
raise ValueError(f"Model {self.config.model_name} not found.")
|
|
|
|
| 10 |
|
| 11 |
if self.config.model_name == "google-safesearch-mini":
|
| 12 |
if not os.path.exists(model_path):
|
| 13 |
+
import urllib.request
|
| 14 |
+
urllib.request.urlretrieve("https://huggingface.co/FredZhang7/google-safesearch-mini/resolve/main/pytorch_model.bin", model_path)
|
|
|
|
|
|
|
| 15 |
self.model = torch.jit.load(model_path)
|
| 16 |
else:
|
| 17 |
raise ValueError(f"Model {self.config.model_name} not found.")
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:db510376e428b0d5f1472e4f56d31a4bfbee69b3e8a58c67a802098e00d42d12
|
| 3 |
+
size 100804217
|