Spaces:
Sleeping
Sleeping
Update src/components/face_shape_detection.py
Browse files
src/components/face_shape_detection.py
CHANGED
|
@@ -17,7 +17,7 @@ class FaceShapeDetection:
|
|
| 17 |
self.classes = ['Heart', 'Oblong', 'Oval', 'Round', 'Square']
|
| 18 |
self.model.load_state_dict(torch.load("/home/ishwor/Desktop/MannequinToModel/artifacts/best_model.pth"))
|
| 19 |
self.model.eval()
|
| 20 |
-
self.model.to("
|
| 21 |
|
| 22 |
self.transform = T.Compose([
|
| 23 |
T.ToPILImage(),
|
|
@@ -42,7 +42,7 @@ class FaceShapeDetectionTransformer:
|
|
| 42 |
def __init__(self):
|
| 43 |
self.t_model = pipeline("image-classification", model="metadome/face_shape_classification",
|
| 44 |
torch_dtype=torch.float16,
|
| 45 |
-
device="
|
| 46 |
|
| 47 |
def detect_face_shape(self, image):
|
| 48 |
result = self.t_model(image)
|
|
|
|
| 17 |
self.classes = ['Heart', 'Oblong', 'Oval', 'Round', 'Square']
|
| 18 |
self.model.load_state_dict(torch.load("/home/ishwor/Desktop/MannequinToModel/artifacts/best_model.pth"))
|
| 19 |
self.model.eval()
|
| 20 |
+
self.model.to("cpu")
|
| 21 |
|
| 22 |
self.transform = T.Compose([
|
| 23 |
T.ToPILImage(),
|
|
|
|
| 42 |
def __init__(self):
|
| 43 |
self.t_model = pipeline("image-classification", model="metadome/face_shape_classification",
|
| 44 |
torch_dtype=torch.float16,
|
| 45 |
+
device="cpu")
|
| 46 |
|
| 47 |
def detect_face_shape(self, image):
|
| 48 |
result = self.t_model(image)
|