Bonosa2 commited on
Commit
c0531db
Β·
verified Β·
1 Parent(s): f5377fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -38,8 +38,10 @@ import base64
38
  from datetime import datetime
39
  from huggingface_hub import login
40
  import os
 
 
 
41
 
42
- @spaces.GPU # This decorator tells HF Spaces to use GPU
43
 
44
  # Authenticate with HuggingFace
45
  print("πŸ” HuggingFace Authentication Required")
@@ -56,7 +58,11 @@ except Exception as e:
56
  print(f"❌ Authentication failed: {e}")
57
  print("Please check your token and try again.")
58
  # Check GPU availability
 
 
 
59
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
60
  print(f"πŸ–₯️ Using device: {device}")
61
  if torch.cuda.is_available():
62
  print(f"πŸš€ GPU: {torch.cuda.get_device_name(0)}")
 
38
  from datetime import datetime
39
  from huggingface_hub import login
40
  import os
41
+ import easyocr
42
+ from PIL import Image
43
+
44
 
 
45
 
46
  # Authenticate with HuggingFace
47
  print("πŸ” HuggingFace Authentication Required")
 
58
  print(f"❌ Authentication failed: {e}")
59
  print("Please check your token and try again.")
60
  # Check GPU availability
61
+ import os
62
+ os.environ["CUDA_VISIBLE_DEVICES"] = "" # Hide all GPUs from PyTorch
63
+
64
  device = "cuda" if torch.cuda.is_available() else "cpu"
65
+ device = "cpu"
66
  print(f"πŸ–₯️ Using device: {device}")
67
  if torch.cuda.is_available():
68
  print(f"πŸš€ GPU: {torch.cuda.get_device_name(0)}")