AdeelHassan commited on
Commit
7be4b16
·
verified ·
1 Parent(s): dc7f79d
Files changed (1) hide show
  1. inference.py +4 -5
inference.py CHANGED
@@ -121,20 +121,20 @@ def _load_hf_models() -> None:
121
  model="prithivMLmods/Deepfake-Detection-Exp-02-21",
122
  device=hf_device,
123
  )
124
- logger.info("HF model 1 loaded.")
125
  except Exception as exc:
126
  logger.warning(f"HF model 1 failed to load: {exc}")
127
  _model_hf1 = False
128
 
129
  if _model_hf2 is None:
130
  try:
131
- logger.info("Loading HF model 2: Deep-Fake-Detector-v2-Model ...")
132
  _model_hf2 = hf_pipeline(
133
  "image-classification",
134
  model="prithivMLmods/Deep-Fake-Detector-v2-Model",
135
  device=hf_device,
136
  )
137
- logger.info("HF model 2 loaded.")
138
  except Exception as exc:
139
  logger.warning(f"HF model 2 failed to load: {exc}")
140
  _model_hf2 = False
@@ -244,9 +244,8 @@ def predict_with_confidence(image_source) -> tuple:
244
  cnn_confidence_pct = cnn_conf * 100
245
  final_confidence = (vote_confidence * 0.6) + (cnn_confidence_pct * 0.4)
246
 
247
- logger.info(
248
  f"CNN={cnn_label}({cnn_conf:.2f}) "
249
- f"HF1={hf1_label} HF2={hf2_label} "
250
  f"Votes ai={ai_votes} real={real_votes}/{total_weight} "
251
  f"→ {final_label} ({final_confidence:.1f}%)"
252
  )
 
121
  model="prithivMLmods/Deepfake-Detection-Exp-02-21",
122
  device=hf_device,
123
  )
124
+ logger.debug("HF model 1 loaded.")
125
  except Exception as exc:
126
  logger.warning(f"HF model 1 failed to load: {exc}")
127
  _model_hf1 = False
128
 
129
  if _model_hf2 is None:
130
  try:
131
+ logger.debug("Loading HF model 2: Deep-Fake-Detector-v2-Model ...")
132
  _model_hf2 = hf_pipeline(
133
  "image-classification",
134
  model="prithivMLmods/Deep-Fake-Detector-v2-Model",
135
  device=hf_device,
136
  )
137
+ logger.debug("HF model 2 loaded.")
138
  except Exception as exc:
139
  logger.warning(f"HF model 2 failed to load: {exc}")
140
  _model_hf2 = False
 
244
  cnn_confidence_pct = cnn_conf * 100
245
  final_confidence = (vote_confidence * 0.6) + (cnn_confidence_pct * 0.4)
246
 
247
+ logger.debug(
248
  f"CNN={cnn_label}({cnn_conf:.2f}) "
 
249
  f"Votes ai={ai_votes} real={real_votes}/{total_weight} "
250
  f"→ {final_label} ({final_confidence:.1f}%)"
251
  )