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 ·
7739462
1
Parent(s): b0e1880
Upload model
Browse files
Model.py
CHANGED
|
@@ -10,7 +10,10 @@ class InceptionV3ModelForImageClassification(PreTrainedModel):
|
|
| 10 |
|
| 11 |
if self.config.model_name == "google-safesearch-mini":
|
| 12 |
if not os.path.exists(model_path):
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
self.model = torch.jit.load(model_path)
|
| 15 |
else:
|
| 16 |
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 requests
|
| 14 |
+
url = "https://huggingface.co/FredZhang7/google-safesearch-mini/resolve/main/pytorch_model.bin"
|
| 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.")
|