Kikut commited on
Commit
dee84bf
·
verified ·
1 Parent(s): c114a19

Deploy IG test profile studio

Browse files
Files changed (4) hide show
  1. Dockerfile +40 -0
  2. README.md +23 -13
  3. facefusion.ini +131 -0
  4. start.sh +14 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.3.2-cudnn9-runtime-ubuntu22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV GRADIO_SERVER_NAME=0.0.0.0
7
+ ENV GRADIO_SERVER_PORT=7860
8
+ ENV GRADIO_ANALYTICS_ENABLED=False
9
+ ENV HF_HOME=/data/.cache/huggingface
10
+
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ ca-certificates \
13
+ curl \
14
+ ffmpeg \
15
+ git \
16
+ python3 \
17
+ python3-pip \
18
+ python3-setuptools \
19
+ && rm -rf /var/lib/apt/lists/*
20
+
21
+ WORKDIR /workspace
22
+
23
+ RUN git clone --depth 1 https://github.com/facefusion/facefusion.git
24
+
25
+ WORKDIR /workspace/facefusion
26
+
27
+ RUN pip3 install --upgrade pip && \
28
+ pip3 install --no-cache-dir -r requirements.txt && \
29
+ pip3 install --no-cache-dir onnxruntime-gpu==1.22.0 && \
30
+ python3 install.py --onnxruntime nvidia
31
+
32
+ COPY facefusion.ini /workspace/facefusion/facefusion.ini
33
+ COPY start.sh /workspace/start.sh
34
+ COPY assets/default_persona.jpg /workspace/facefusion/assets/default_persona.jpg
35
+
36
+ RUN chmod +x /workspace/start.sh
37
+
38
+ EXPOSE 7860
39
+
40
+ CMD ["/workspace/start.sh"]
README.md CHANGED
@@ -1,23 +1,33 @@
1
  ---
2
- title: Live Full Body Replace
3
  colorFrom: blue
4
- colorTo: green
5
- sdk: gradio
6
- sdk_version: 5.49.1
7
- app_file: app.py
8
  pinned: false
9
  ---
10
 
11
- # Live Full Body Replace
12
 
13
- This Space is dedicated to a single workflow:
14
 
15
- - use preloaded persona image (or upload your own)
16
- - stream webcam input
17
- - get live full-body replacement output
18
 
19
- If segmentation is uncertain for a frame, the app falls back to a body-box estimate to keep the stream responsive.
 
 
 
 
 
20
 
21
- Default persona source: https://www.pexels.com/photo/elegant-woman-in-all-white-outfit-with-hijab-31215273/
22
 
23
- Set `HF_TOKEN` as a Space secret to avoid entering it in the UI.
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Live Upper-Body Swap (FaceFusion)
3
  colorFrom: blue
4
+ colorTo: pink
5
+ sdk: docker
6
+ app_port: 7860
 
7
  pinned: false
8
  ---
9
 
10
+ # Live Upper-Body Swap (FaceFusion)
11
 
12
+ This Space runs FaceFusion in `webcam` mode for realistic live face swap.
13
 
14
+ ## How it works
 
 
15
 
16
+ 1. Open the Space in browser.
17
+ 2. In FaceFusion UI, set `Source` image to a clear front-facing portrait.
18
+ 3. Start webcam target and run with:
19
+ - `processors`: `face_swapper`, `face_enhancer`, `expression_restorer`
20
+ - `face masker`: `occlusion + region`
21
+ 4. Tune blend until movement and identity look natural.
22
 
23
+ ## Why this is more realistic than overlay
24
 
25
+ - true face swap model (not static image paste)
26
+ - temporal consistency from webcam layout
27
+ - enhancer and expression restorer for live motion quality
28
+
29
+ ## Notes
30
+
31
+ - Best result comes from good lighting and neutral background.
32
+ - This is designed for consent-based identity effects only.
33
+ - A stronger GPU (for example `a10g-large`) is recommended.
facefusion.ini ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [paths]
2
+ temp_path = /tmp
3
+ jobs_path = .jobs
4
+ source_paths = assets/default_persona.jpg
5
+ target_path =
6
+ output_path =
7
+
8
+ [patterns]
9
+ source_pattern =
10
+ target_pattern =
11
+ output_pattern =
12
+
13
+ [face_detector]
14
+ face_detector_model = many
15
+ face_detector_size = 640x640
16
+ face_detector_margin = 0 0 0 0
17
+ face_detector_angles = 0
18
+ face_detector_score = 0.45
19
+
20
+ [face_landmarker]
21
+ face_landmarker_model = 2dfan4
22
+ face_landmarker_score = 0.45
23
+
24
+ [face_selector]
25
+ face_selector_mode = one
26
+ face_selector_order = large-small
27
+ face_selector_age_start =
28
+ face_selector_age_end =
29
+ face_selector_gender =
30
+ face_selector_race =
31
+ reference_face_position = 0
32
+ reference_face_distance = 0.40
33
+ reference_frame_number = 0
34
+
35
+ [face_masker]
36
+ face_occluder_model = xseg_1
37
+ face_parser_model = bisenet_resnet_34
38
+ face_mask_types = occlusion region
39
+ face_mask_areas = upper-face lower-face mouth
40
+ face_mask_regions = skin left-eyebrow right-eyebrow left-eye right-eye glasses nose mouth upper-lip lower-lip
41
+ face_mask_blur = 0.20
42
+ face_mask_padding = 10 10 14 10
43
+
44
+ [voice_extractor]
45
+ voice_extractor_model = kim_vocal_2
46
+
47
+ [frame_extraction]
48
+ trim_frame_start =
49
+ trim_frame_end =
50
+ temp_frame_format = png
51
+ keep_temp = false
52
+
53
+ [output_creation]
54
+ output_image_quality = 95
55
+ output_image_scale = 1.0
56
+ output_audio_encoder = aac
57
+ output_audio_quality = 80
58
+ output_audio_volume = 100
59
+ output_video_encoder = libx264
60
+ output_video_preset = veryfast
61
+ output_video_quality = 85
62
+ output_video_scale = 1.0
63
+ output_video_fps = 30
64
+
65
+ [processors]
66
+ processors = face_swapper face_enhancer expression_restorer
67
+ age_modifier_model = styleganex_age
68
+ age_modifier_direction = 0
69
+ background_remover_model = birefnet_portrait
70
+ background_remover_color = 0 0 0 0
71
+ deep_swapper_model = iperov/elon_musk_224
72
+ deep_swapper_morph = 100
73
+ expression_restorer_model = live_portrait
74
+ expression_restorer_factor = 80
75
+ expression_restorer_areas = upper-face lower-face
76
+ face_debugger_items = face-landmark-5/68 face-mask
77
+ face_editor_model = live_portrait
78
+ face_editor_eyebrow_direction = 0
79
+ face_editor_eye_gaze_horizontal = 0
80
+ face_editor_eye_gaze_vertical = 0
81
+ face_editor_eye_open_ratio = 0
82
+ face_editor_lip_open_ratio = 0
83
+ face_editor_mouth_grim = 0
84
+ face_editor_mouth_pout = 0
85
+ face_editor_mouth_purse = 0
86
+ face_editor_mouth_smile = 0
87
+ face_editor_mouth_position_horizontal = 0
88
+ face_editor_mouth_position_vertical = 0
89
+ face_editor_head_pitch = 0
90
+ face_editor_head_yaw = 0
91
+ face_editor_head_roll = 0
92
+ face_enhancer_model = gfpgan_1.4
93
+ face_enhancer_blend = 80
94
+ face_enhancer_weight = 1.0
95
+ face_swapper_model = inswapper_128_fp16
96
+ face_swapper_pixel_boost = 768x768
97
+ face_swapper_weight = 1.0
98
+ frame_colorizer_model = ddcolor
99
+ frame_colorizer_size = 256x256
100
+ frame_colorizer_blend = 85
101
+ frame_enhancer_model = span_kendata_x4
102
+ frame_enhancer_blend = 80
103
+ lip_syncer_model = wav2lip_gan_96
104
+ lip_syncer_weight = 1.0
105
+
106
+ [uis]
107
+ open_browser = false
108
+ ui_layouts = webcam
109
+ ui_workflow = instant_runner
110
+
111
+ [download]
112
+ download_providers = huggingface github
113
+ download_scope = lite
114
+
115
+ [benchmark]
116
+ benchmark_mode = warm
117
+ benchmark_resolutions = 720p
118
+ benchmark_cycle_count = 3
119
+
120
+ [execution]
121
+ execution_device_ids = 0
122
+ execution_providers = cuda
123
+ execution_thread_count = 8
124
+
125
+ [memory]
126
+ video_memory_strategy = tolerant
127
+ system_memory_limit = 0
128
+
129
+ [misc]
130
+ log_level = info
131
+ halt_on_error = false
start.sh ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd /workspace/facefusion
5
+
6
+ providers=(cuda)
7
+ if ! command -v nvidia-smi >/dev/null 2>&1; then
8
+ providers=(cpu)
9
+ fi
10
+
11
+ python3 facefusion.py run \
12
+ --ui-layouts webcam \
13
+ --processors face_swapper face_enhancer expression_restorer \
14
+ --execution-providers "${providers[@]}"