kush5699 commited on
Commit
5e5f9c3
·
1 Parent(s): 45b6fe7

Fix: gracefully disable RF-DETR on CPU-only environments

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -0
src/streamlit_app.py CHANGED
@@ -421,6 +421,11 @@ def load_rfdetr():
421
  print(f"[WARNING] RF-DETR model not found")
422
  return None
423
  try:
 
 
 
 
 
424
  from rfdetr import RFDETRBase
425
  model = RFDETRBase(pretrain_weights=str(rfdetr_path))
426
  print(f"[OK] RF-DETR loaded ({rfdetr_path.stat().st_size/1e6:.1f} MB)")
 
421
  print(f"[WARNING] RF-DETR model not found")
422
  return None
423
  try:
424
+ import torch
425
+ # RF-DETR needs CUDA; if not available, skip gracefully
426
+ if not torch.cuda.is_available():
427
+ print("[WARNING] RF-DETR requires GPU (CUDA). Running on CPU — RF-DETR disabled.")
428
+ return None
429
  from rfdetr import RFDETRBase
430
  model = RFDETRBase(pretrain_weights=str(rfdetr_path))
431
  print(f"[OK] RF-DETR loaded ({rfdetr_path.stat().st_size/1e6:.1f} MB)")