Weiyun1025's picture
Upload folder using huggingface_hub
2abfccb verified
from PIL import Image
import io
from petrel_client.client import Client
client = Client('./conf/petreloss.conf')
# read image file from ceph
img_url = 's3://bucket1/image.png'
image_data = client.get(img_url)
image = Image.open(io.BytesIO(image_data))
# write image file to ceph
new_img_url = 's3://bucket1/new_image.png'
new_image_data = io.BytesIO()
image.save(new_image_data, format='PNG')
client.put(new_img_url, new_image_data.getvalue())