Update README.md
Browse files
README.md
CHANGED
@@ -20,6 +20,12 @@ from PIL import Image
|
|
20 |
import torch
|
21 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
ckpt = 'yainage90/fashion-object-detection'
|
24 |
image_processor = AutoImageProcessor.from_pretrained(ckpt)
|
25 |
model = AutoModelForObjectDetection.from_pretrained(ckpt).to(device)
|
|
|
20 |
import torch
|
21 |
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
22 |
|
23 |
+
device = 'cpu'
|
24 |
+
if torch.cuda.is_available():
|
25 |
+
device = torch.device('cuda')
|
26 |
+
elif torch.backends.mps.is_available():
|
27 |
+
device = torch.device('mps')
|
28 |
+
|
29 |
ckpt = 'yainage90/fashion-object-detection'
|
30 |
image_processor = AutoImageProcessor.from_pretrained(ckpt)
|
31 |
model = AutoModelForObjectDetection.from_pretrained(ckpt).to(device)
|