feuerblitz7 commited on
Commit
3fad1cd
·
1 Parent(s): 26faadc

Ensure RFDETR is run from cpu

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -43,15 +43,11 @@ models = {
43
  "RF-DETR": None
44
  }
45
 
46
- # You only need to set this if the models are PRIVATE
47
- # HF_TOKEN = os.getenv("HF_TOKEN")
48
-
49
  def get_model_path(repo_id, filename):
50
  """Downloads model from HF Hub and returns local path."""
51
  return hf_hub_download(
52
  repo_id=repo_id,
53
- filename=filename,
54
- # token=HF_TOKEN # Use this only if the repo is private
55
  )
56
 
57
  def load_yolo():
@@ -76,7 +72,8 @@ def load_rf_detr():
76
  if models["RF-DETR"] is None and RFDETRLarge is not None:
77
  model_path = get_model_path("microlab-chalmers/microvision-rfdetr", "microvision_rfdetr.pth")
78
  models["RF-DETR"] = RFDETRLarge(
79
- pretrain_weights=model_path
 
80
  )
81
  models["RF-DETR"].optimize_for_inference(compile=False)
82
  return models["RF-DETR"]
 
43
  "RF-DETR": None
44
  }
45
 
 
 
 
46
  def get_model_path(repo_id, filename):
47
  """Downloads model from HF Hub and returns local path."""
48
  return hf_hub_download(
49
  repo_id=repo_id,
50
+ filename=filename
 
51
  )
52
 
53
  def load_yolo():
 
72
  if models["RF-DETR"] is None and RFDETRLarge is not None:
73
  model_path = get_model_path("microlab-chalmers/microvision-rfdetr", "microvision_rfdetr.pth")
74
  models["RF-DETR"] = RFDETRLarge(
75
+ pretrain_weights=model_path,
76
+ device="cpu"
77
  )
78
  models["RF-DETR"].optimize_for_inference(compile=False)
79
  return models["RF-DETR"]