INNER CODE UNIT · Python
upload_to_gcs
openfoodfacts/openfoodfacts-ai · category-detection/main.py:292
async def upload_to_gcs(
image_url: str,
bucket_name: str,
blob_name: str,
session: aiohttp.ClientSession,
base_image_dir: Path | None = None,
) -> dict:
"""Upload data to Google Cloud Storage.
Args:
bucket_name (str): Name of the GCS bucket.
blob_name (str): Name of the blob (object) in the bucket.
data (bytes): Data to upload.
session (aiohttp.ClientSession): HTTP session to use for downloading
the image.
base_image_dir (Path | None): If provided, images will be read from
the filesystem under this base directory instead of downloading
them from their URLs.
Returns: