xktan commited on
Commit
fea2c53
·
verified ·
1 Parent(s): 6dd4b8b

Rename adanalyst_mar30_logo (1).py to app.py

Browse files
adanalyst_mar30_logo (1).py → app.py RENAMED
@@ -477,11 +477,12 @@ def perform_object_detection(image_pil):
477
  """## Logo"""
478
 
479
  # Commented out IPython magic to ensure Python compatibility.
480
- !git clone https://github.com/WongKinYiu/yolov7.git
481
- # %cd yolov7
482
- !wget -O logo_detection.pt https://huggingface.co/spaces/xktan/Ad_Analyst/resolve/main/logo_detection.pt
483
-
484
- logo_model = torch.hub.load('/content/yolov7', 'custom', '/content/yolov7/logo_detection.pt', source='local')
 
485
  logo_model.conf = 0.25
486
 
487
  def detect_logos(pil_image):
 
477
  """## Logo"""
478
 
479
  # Commented out IPython magic to ensure Python compatibility.
480
+ if not os.path.exists("yolov7"):
481
+ with zipfile.ZipFile("yolov7.zip", 'r') as zip_ref:
482
+ zip_ref.extractall(".")
483
+ print("files", os.listdir("."))
484
+ sys.path.append("./yolov7")
485
+ logo_model = torch.hub.load('./yolov7', 'custom', './logo_detection.pt', source='local')
486
  logo_model.conf = 0.25
487
 
488
  def detect_logos(pil_image):