Fix no face not label not showing
Browse files303 unmodified lines3043053063073083093103113123133143154 unmodified lines320321322323324325326303 unmodified linesprobs = torch.softmax(logits, dim=1).cpu().numpy()for idx, (orig_frame, (crop, has_face)) in enumerate(zip(frames, crops_info)):p_fake = float(probs[idx, 0])p_real = float(probs[idx, 1])label = "fake" if p_fake >= p_real else "real"score = p_fake if label == "fake" else p_realimg_for_display = crop if has_face and crop is not None else orig_frameframe_b64 = b64_encode_image_bgr(img_for_display)out_frames.append(frame_b64)4 unmodified lines"score": float(score),"prob_real": p_real,"prob_fake": p_fake,"has_face": bool(has_face),})303 unmodified lines3043053063073083093103113123133143153163173183193203213224 unmodified lines327328329330331332333303 unmodified linesprobs = torch.softmax(logits, dim=1).cpu().numpy()for idx, (orig_frame, (crop, has_face)) in enumerate(zip(frames, crops_info)):if has_face and crop is not None:p_fake = float(probs[idx, 0])p_real = float(probs[idx, 1])label = "fake" if p_fake >= p_real else "real"score = p_fake if label == "fake" else p_realimg_for_display = cropelse:p_fake = 0.0p_real = 0.0label = "no_face"score = 0.0img_for_display = orig_frameframe_b64 = b64_encode_image_bgr(img_for_display)out_frames.append(frame_b64)4 unmodified lines"score": float(score),"prob_real": p_real,"prob_fake": p_fake,"has_face": bool(has_face and crop is not None),})
app.py+13-6