Skip to content

Commit

Permalink
Temporarily disable ssl verification for model download
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed May 1, 2023
1 parent 1ded077 commit 3f7c2e8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401, B905
ignore = E203, E266, E501, W503, F403, F401, B905, E402
max-line-length = 79
max-complexity = 18
select = B,C,E,F,W,T4,B9
2 changes: 1 addition & 1 deletion anylabeling/app_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__appname__ = "AnyLabeling"
__appdescription__ = "Effortless data labeling with AI support"
__version__ = "0.2.15"
__version__ = "0.2.16"
16 changes: 11 additions & 5 deletions anylabeling/services/auto_labeling/model.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import logging
import os
import pathlib
import yaml
import onnx
import urllib.request

# Temporarily disable SSL verification
import ssl

ssl._create_default_https_context = ssl._create_unverified_context

from abc import abstractmethod

import yaml
import onnx

from PyQt5.QtCore import QFile, QObject
from PyQt5.QtGui import QImage
Expand Down Expand Up @@ -100,8 +106,8 @@ def get_model_abs_path(self, model_path, model_folder_name):
try:
onnx.checker.check_model(model_abs_path)
except onnx.checker.ValidationError as e:
print("The model is invalid: %s" % e)
print("Action: Delete and redownload...")
logging.warning("The model is invalid: %s", str(e))
logging.warning("Action: Delete and redownload...")
os.remove(model_abs_path)
else:
return model_abs_path
Expand All @@ -116,7 +122,7 @@ def get_model_abs_path(self, model_path, model_folder_name):
download_url[:20] + "..." + download_url[-20:]
)
logging.info(
f"Downloading {ellipsis_download_url} to {model_abs_path}"
"Downloading %s to %s", ellipsis_download_url, model_abs_path
)
try:
# Download and show progress
Expand Down

0 comments on commit 3f7c2e8

Please sign in to comment.