Spaces:
Sleeping
Sleeping
File size: 370 Bytes
0e73e41 cf8ee25 0e73e41 d5cf56e cf8ee25 d5cf56e |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# tools/image_wrapper.py
import os
from datetime import datetime
def save_image_to_tmp(img) -> str:
"""Sauvegarde une image PIL dans /tmp et renvoie le chemin."""
ts = datetime.utcnow().strftime("%Y%m%d_%H%M%S")
filename = f"generated_image_{ts}.webp"
filepath = os.path.join("/tmp", filename)
img.save(filepath, format="WEBP")
return filepath
|