FredZhang7 commited on
Commit
7739462
·
1 Parent(s): b0e1880

Upload model

Browse files
Files changed (1) hide show
  1. Model.py +4 -1
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
- model_path = f"./InceptionV3/{model_path}"
 
 
 
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.")