edeler commited on
Commit
1efafce
·
verified ·
1 Parent(s): 315b4d2

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -1,3 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
  import json
3
  import gc
@@ -38,18 +50,6 @@ except ImportError:
38
  print("Warning: RF-DETR not found. Please ensure it's properly installed.")
39
  RFDETRMedium = None
40
 
41
- # Try to import spaces for Hugging Face Spaces GPU support
42
- try:
43
- import spaces
44
- HF_SPACES_GPU = True
45
- except ImportError:
46
- # Create a dummy decorator if not running on Spaces
47
- class spaces:
48
- @staticmethod
49
- def GPU(func):
50
- return func
51
- HF_SPACES_GPU = False
52
-
53
  # ============================================================================
54
  # Configuration for Hugging Face Spaces
55
  # ============================================================================
 
1
+ # IMPORTANT: Import spaces FIRST, before any CUDA-related packages
2
+ try:
3
+ import spaces
4
+ HF_SPACES_GPU = True
5
+ except ImportError:
6
+ # Create a dummy decorator if not running on Spaces
7
+ class spaces:
8
+ @staticmethod
9
+ def GPU(func):
10
+ return func
11
+ HF_SPACES_GPU = False
12
+
13
  import os
14
  import json
15
  import gc
 
50
  print("Warning: RF-DETR not found. Please ensure it's properly installed.")
51
  RFDETRMedium = None
52
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  # ============================================================================
54
  # Configuration for Hugging Face Spaces
55
  # ============================================================================