primerz commited on
Commit
0117fa7
·
verified ·
1 Parent(s): 3ae9ca7

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +4 -4
model.py CHANGED
@@ -112,7 +112,7 @@ class ModelHandler:
112
  # --- NEW: Enable xFormers ---
113
  try:
114
  self.pipeline.enable_xformers_memory_efficient_attention()
115
- print(" [OK] xFormmrs memory efficient attention enabled.")
116
  except Exception as e:
117
  print(f" [WARNING] Failed to enable xFormers: {e}")
118
  # --- END NEW ---
@@ -165,15 +165,15 @@ class ModelHandler:
165
  return None
166
 
167
  try:
168
- cv2_img = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR)
169
  faces = self.app.get(cv2_img)
170
 
171
  if len(faces) == 0:
172
  return None
173
 
174
  # Sort by size (width * height) to find the main character
175
- # --- MODIFIED: Fixed typo x['bbox[0]) -> x['bbox'][0]) ---
176
- faces = sorted(faces, key=lambda x: (x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x'bbox'[1]), reverse=True)
177
  # --- END MODIFIED ---
178
 
179
  # Return the largest face info
 
112
  # --- NEW: Enable xFormers ---
113
  try:
114
  self.pipeline.enable_xformers_memory_efficient_attention()
115
+ print(" [OK] xFormers memory efficient attention enabled.")
116
  except Exception as e:
117
  print(f" [WARNING] Failed to enable xFormers: {e}")
118
  # --- END NEW ---
 
165
  return None
166
 
167
  try:
168
+ cv2_img = cv2.cvtColor(np.array(image), cv2.COLOR_RGBBGR)
169
  faces = self.app.get(cv2_img)
170
 
171
  if len(faces) == 0:
172
  return None
173
 
174
  # Sort by size (width * height) to find the main character
175
+ # --- MODIFIED: Fixed typo ---
176
+ faces = sorted(faces, key=lambda x: (x['bbox'][2]-x['bbox'][0])*(x['bbox'][3]-x['bbox'][1]), reverse=True)
177
  # --- END MODIFIED ---
178
 
179
  # Return the largest face info