立即学习:https://edu.csdn.net/course/play/27211/379060?utm_source=blogtoedu
from removebg import RemoveBg
import os
rmbg = RemoveBg("6deXhZhs2LrRoMLaN2HxGMLh","error.log")#引号内是API秘钥
path = 'image/removebg'
for pic in os.listdir(path):
img_path = os.path.join(path,pic)
rmbg.remove_background_from_img_file(img_path)#图片地址
print(f'{img_path} is done')