LogicGoInfotechSpaces commited on
Commit
6529bcc
·
1 Parent(s): 0c287d4

FaceSwapper: final fallback to insightface.model_zoo.get_model by name if mirrors fail

Browse files
DeepFakeAI/processors/frame/modules/face_swapper.py CHANGED
@@ -47,14 +47,9 @@ def get_frame_processor() -> Any:
47
  model_path = None # keep trying
48
  # If HF Hub failed, try public mirrors as a last resort
49
  if not model_path:
50
- # Try multiple mirrors (HF resolve links first, then GitHub)
51
- conditional_download(local_dir, [
52
- 'https://huggingface.co/zihaomu/inswapper_128.onnx/resolve/main/inswapper_128.onnx',
53
- 'https://huggingface.co/linyi/inswapper_128.onnx/resolve/main/inswapper_128.onnx',
54
- 'https://huggingface.co/banodoco/inswapper_128.onnx/resolve/main/inswapper_128.onnx',
55
- 'https://github.com/facefusion/facefusion-assets/releases/download/models/inswapper_128.onnx'
56
- ])
57
- model_path = local_model_path
58
  else:
59
  model_path = local_model_path
60
  FRAME_PROCESSOR = insightface.model_zoo.get_model(model_path, providers = DeepFakeAI.globals.execution_providers)
 
47
  model_path = None # keep trying
48
  # If HF Hub failed, try public mirrors as a last resort
49
  if not model_path:
50
+ # As a robust fallback, let insightface download by name into its own cache
51
+ FRAME_PROCESSOR = insightface.model_zoo.get_model('inswapper_128.onnx', providers = DeepFakeAI.globals.execution_providers)
52
+ return FRAME_PROCESSOR
 
 
 
 
 
53
  else:
54
  model_path = local_model_path
55
  FRAME_PROCESSOR = insightface.model_zoo.get_model(model_path, providers = DeepFakeAI.globals.execution_providers)