ruminasval commited on
Commit
b908b38
·
verified ·
1 Parent(s): d80d0e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -60,14 +60,14 @@ def preprocess_image(image):
60
 
61
  image = cv2.resize(image, (224, 224))
62
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
 
 
 
 
63
 
64
- inputs = feature_extractor(
65
- images=[image],
66
- return_tensors="pt",
67
- padding=True
68
- )
69
  return inputs['pixel_values']
70
 
 
71
  def predict_face_shape(image):
72
  # Force CPU usage on Hugging Face Spaces
73
  device = torch.device("cpu")
 
60
 
61
  image = cv2.resize(image, (224, 224))
62
  image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
63
+
64
+ # Convert to PIL and extract
65
+ image_pil = Image.fromarray(image)
66
+ inputs = feature_extractor(images=image_pil, return_tensors="pt")
67
 
 
 
 
 
 
68
  return inputs['pixel_values']
69
 
70
+
71
  def predict_face_shape(image):
72
  # Force CPU usage on Hugging Face Spaces
73
  device = torch.device("cpu")