Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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)}")
|