@@ -335,29 +335,29 @@ def face_swap_api(job_id: str, job_input: dict):
335335 target_file .write (target_image )
336336
337337 try :
338- logger .info (f'Source indexes: { job_input [ "source_indexes" ] } ' , job_id )
339- logger .info (f'Target indexes: { job_input [ "target_indexes" ] } ' , job_id )
340- logger .info (f'Background enhance: { job_input [ "background_enhance" ] } ' , job_id )
341- logger .info (f'Face Restoration: { job_input [ "face_restore" ] } ' , job_id )
342- logger .info (f'Face Upsampling: { job_input [ "face_upsample" ] } ' , job_id )
343- logger .info (f'Upscale: { job_input [ "upscale" ] } ' , job_id )
344- logger .info (f'Codeformer Fidelity: { job_input [ "codeformer_fidelity" ] } ' , job_id )
345- logger .info (f'Output Format: { job_input [ "output_format" ] } ' , job_id )
346- logger .info (f'Min Face Size: { job_input [ "min_face_size" ] } ' , job_id )
338+ logger .info (f'Source indexes: { job_input . get ( "source_indexes" , "-1" ) } ' , job_id )
339+ logger .info (f'Target indexes: { job_input . get ( "target_indexes" , "-1" ) } ' , job_id )
340+ logger .info (f'Background enhance: { job_input . get ( "background_enhance" , True ) } ' , job_id )
341+ logger .info (f'Face Restoration: { job_input . get ( "face_restore" , True ) } ' , job_id )
342+ logger .info (f'Face Upsampling: { job_input . get ( "face_upsample" , True ) } ' , job_id )
343+ logger .info (f'Upscale: { job_input . get ( "upscale" , 1 ) } ' , job_id )
344+ logger .info (f'Codeformer Fidelity: { job_input . get ( "codeformer_fidelity" , 0.5 ) } ' , job_id )
345+ logger .info (f'Output Format: { job_input . get ( "output_format" , "JPEG" ) } ' , job_id )
346+ logger .info (f'Min Face Size: { job_input . get ( "min_face_size" , 0.0 ) } ' , job_id )
347347
348348 result_image = face_swap (
349349 job_id ,
350350 source_image_path ,
351351 target_image_path ,
352- job_input [ 'source_indexes' ] ,
353- job_input [ 'target_indexes' ] ,
354- job_input [ 'background_enhance' ] ,
355- job_input [ 'face_restore' ] ,
356- job_input [ 'face_upsample' ] ,
357- job_input [ 'upscale' ] ,
358- job_input [ 'codeformer_fidelity' ] ,
359- job_input [ 'output_format' ] ,
360- job_input [ 'min_face_size' ]
352+ job_input . get ( 'source_indexes' , '-1' ) ,
353+ job_input . get ( 'target_indexes' , '-1' ) ,
354+ job_input . get ( 'background_enhance' , True ) ,
355+ job_input . get ( 'face_restore' , True ) ,
356+ job_input . get ( 'face_upsample' , True ) ,
357+ job_input . get ( 'upscale' , 1 ) ,
358+ job_input . get ( 'codeformer_fidelity' , 0.5 ) ,
359+ job_input . get ( 'output_format' , 'JPEG' ) ,
360+ job_input . get ( 'min_face_size' , 0.0 )
361361 )
362362
363363 clean_up_temporary_files (source_image_path , target_image_path )
0 commit comments