Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 84c6f88

Browse files
shuoweilGarrettWuchelsea-linsycai
authored
docs: Add EXIF metadata extraction example to multimodal notebook (#2429)
This PR updates the notebooks/multimodal/multimodal_dataframe.ipynb notebook to include a comprehensive example of extracting EXIF metadata from images. Key Changes: * Added a new section "7. Extract EXIF metadata from images". * Implemented a custom remote function (UDF) using pillow and requests to retrieve and parse EXIF tags from image URLs. * Demonstrated how to apply this function efficiently within a BigFrames workflow to analyze image metadata. This addition provides users with a practical pattern for handling image metadata and using custom libraries within BigQuery DataFrames. Fixes #<478952827> 🦕 --------- Co-authored-by: Garrett Wu <6505921+GarrettWu@users.noreply.github.com> Co-authored-by: Chelsea Lin <chelsealin@google.com> Co-authored-by: Shenyang Cai <sycai@users.noreply.github.com>
1 parent 9f1ba1d commit 84c6f88

1 file changed

Lines changed: 92 additions & 2 deletions

File tree

notebooks/multimodal/multimodal_dataframe.ipynb

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
"3. Conduct image transformations\n",
6262
"4. Use LLM models to ask questions and generate embeddings on images\n",
6363
"5. PDF chunking function\n",
64-
"6. Transcribe audio"
64+
"6. Transcribe audio\n",
65+
"7. Extract EXIF metadata from images"
6566
]
6667
},
6768
{
@@ -104,6 +105,11 @@
104105
"PROJECT = \"bigframes-dev\" # replace with your project. \n",
105106
"# Refer to https://cloud.google.com/bigquery/docs/multimodal-data-dataframes-tutorial#required_roles for your required permissions\n",
106107
"\n",
108+
"LOCATION = \"us\" # replace with your location.\n",
109+
"\n",
110+
"# Dataset where the UDF will be created.\n",
111+
"DATASET_ID = \"bigframes_samples\" # replace with your dataset ID.\n",
112+
"\n",
107113
"OUTPUT_BUCKET = \"bigframes_blob_test\" # replace with your GCS bucket. \n",
108114
"# The connection (or bigframes-default-connection of the project) must have read/write permission to the bucket. \n",
109115
"# Refer to https://cloud.google.com/bigquery/docs/multimodal-data-dataframes-tutorial#grant-permissions for setting up connection service account permissions.\n",
@@ -112,12 +118,14 @@
112118
"import bigframes\n",
113119
"# Setup project\n",
114120
"bigframes.options.bigquery.project = PROJECT\n",
121+
"bigframes.options.bigquery.location = LOCATION\n",
115122
"\n",
116123
"# Display options\n",
117124
"bigframes.options.display.blob_display_width = 300\n",
118125
"bigframes.options.display.progress_bar = None\n",
119126
"\n",
120-
"import bigframes.pandas as bpd"
127+
"import bigframes.pandas as bpd\n",
128+
"import bigframes.bigquery as bbq"
121129
]
122130
},
123131
{
@@ -1546,6 +1554,88 @@
15461554
"transcribed_series_verbose = df['audio'].blob.audio_transcribe(model_name=\"gemini-2.0-flash-001\", verbose=True)\n",
15471555
"transcribed_series_verbose"
15481556
]
1557+
},
1558+
{
1559+
"cell_type": "markdown",
1560+
"metadata": {},
1561+
"source": [
1562+
"### 7. Extract EXIF metadata from images"
1563+
]
1564+
},
1565+
{
1566+
"cell_type": "markdown",
1567+
"metadata": {},
1568+
"source": [
1569+
"This section demonstrates how to extract EXIF metadata from images using a custom BigQuery Python UDF and the `Pillow` library."
1570+
]