How to use batch_images in FaceSwapUnit #159

Open
opened 2023-12-06 05:40:47 +01:00 by jiyoon0630 · 1 comment
jiyoon0630 commented 2023-12-06 05:40:47 +01:00 (Migrated from github.com)

Hi.

I was following faceswaplab_api_exambple.py and I'd like to ask how to use batch_images in FaceSwapUnit.

In api_utils.py, batch_images means "list of base64 batch source images" which can be used for blending multiple user images.

However, if I set batch_images as a list of base64 images, then validation error comes like below.

unit1 = FaceSwapUnit(
    source_img=pil_to_base64("user1.png"),  
    batch_images=[pil_to_base64('user1.png'), pil_to_base64('user2.png')]
)

ValidationError: 1 validation error for FaceSwapUnit
batch_images
wrong tuple length 2, expected 1 (type=value_error.tuple.length; actual_length=2; expected_length=1)

I've check that the error comes from Tuple[str]. So I tried to change it to Tuple[str, ... ] or List[str], but it causes same error while requesting.

{'detail': [{'loc': ['body', 'units', 0, 'batch_images'],
'msg': 'wrong tuple length 2, expected 1',
'type': 'value_error.tuple.length',
'ctx': {'actual_length': 2, 'expected_length': 1}}]}

Can you explain how to use batch_images?

Hi. I was following [faceswaplab_api_exambple.py](https://github.com/glucauze/sd-webui-faceswaplab/blob/main/client_api/faceswaplab_api_example.py) and I'd like to ask how to use batch_images in FaceSwapUnit. In [api_utils.py](https://github.com/glucauze/sd-webui-faceswaplab/blob/main/client_api/api_utils.py), batch_images means "list of base64 batch source images" which can be used for blending multiple user images. However, if I set batch_images as a list of base64 images, then validation error comes like below. ``` unit1 = FaceSwapUnit( source_img=pil_to_base64("user1.png"), batch_images=[pil_to_base64('user1.png'), pil_to_base64('user2.png')] ) ``` **ValidationError: 1 validation error for FaceSwapUnit batch_images wrong tuple length 2, expected 1 (type=value_error.tuple.length; actual_length=2; expected_length=1)** I've check that the error comes from Tuple[str]. So I tried to change it to Tuple[str, ... ] or List[str], but it causes same error while requesting. **{'detail': [{'loc': ['body', 'units', 0, 'batch_images'], 'msg': 'wrong tuple length 2, expected 1', 'type': 'value_error.tuple.length', 'ctx': {'actual_length': 2, 'expected_length': 1}}]}** Can you explain how to use batch_images?
ChenCheng2Cs commented 2023-12-13 03:46:55 +01:00 (Migrated from github.com)

Did you solve it?

Did you solve it?
Sign in to join this conversation.