DurgaDeepak commited on
Commit
03b47ac
·
verified ·
1 Parent(s): 5caf904

Update core/process.py

Browse files
Files changed (1) hide show
  1. core/process.py +2 -1
core/process.py CHANGED
@@ -5,6 +5,7 @@ import io
5
  import zipfile
6
  import json
7
  import cv2
 
8
  import numpy as np
9
  from PIL import Image
10
 
@@ -76,7 +77,7 @@ def process_image(
76
  if run_det:
77
  logger.info(f"Running detection with model: {det_model}")
78
  load_start = time.time()
79
- model = get_model("detection", det_model, device="cpu")
80
  model.load_model()
81
  logger.info(f"{det_model} detection model loaded in {time.time() - load_start:.2f} seconds.")
82
  boxes = model.predict(image, conf_threshold=det_confidence)
 
5
  import zipfile
6
  import json
7
  import cv2
8
+ import torch
9
  import numpy as np
10
  from PIL import Image
11
 
 
77
  if run_det:
78
  logger.info(f"Running detection with model: {det_model}")
79
  load_start = time.time()
80
+ model = get_model("detection", det_model, device="cuda" if torch.cuda.is_available() else "cpu")
81
  model.load_model()
82
  logger.info(f"{det_model} detection model loaded in {time.time() - load_start:.2f} seconds.")
83
  boxes = model.predict(image, conf_threshold=det_confidence)