Skip to content

Commit 8ec55cc

Browse files
GarrettWushobsi
andauthored
chore: multimodal snippets has to input gcs folder (#1616)
* chore: multimodal snippets has to input gcs folder * rename * Update samples/snippets/multimodal_test.py Co-authored-by: Shobhit Singh <[email protected]> --------- Co-authored-by: Shobhit Singh <[email protected]>
1 parent 40d6960 commit 8ec55cc

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

samples/snippets/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ def dataset_id_eu(bigquery_client: bigquery.Client, project_id: str) -> Iterator
7676
bigquery_client.delete_dataset(dataset, delete_contents=True, not_found_ok=True)
7777

7878

79+
@pytest.fixture(scope="session")
80+
def gcs_dst_bucket() -> str:
81+
return "gs://bigframes_blob_test"
82+
83+
7984
@pytest.fixture
8085
def random_model_id(
8186
bigquery_client: bigquery.Client, project_id: str, dataset_id: str

samples/snippets/multimodal_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
# limitations under the License.
1414

1515

16-
def test_multimodal_dataframe() -> None:
16+
def test_multimodal_dataframe(gcs_dst_bucket: str) -> None:
17+
# destination folder must be in a GCS bucket that the BQ connection service account (default or user provided) has write access to.
18+
dst_bucket = gcs_dst_bucket
1719
# [START bigquery_dataframes_multimodal_dataframe_create]
1820
import bigframes
1921

@@ -52,21 +54,21 @@ def test_multimodal_dataframe() -> None:
5254

5355
# [START bigquery_dataframes_multimodal_dataframe_image_transform]
5456
df_image["blurred"] = df_image["image"].blob.image_blur(
55-
(20, 20), dst="gs://bigframes_blob_test/image_blur_transformed/"
57+
(20, 20), dst=f"{dst_bucket}/image_blur_transformed/"
5658
)
5759
df_image["resized"] = df_image["image"].blob.image_resize(
58-
(300, 200), dst="gs://bigframes_blob_test/image_resize_transformed/"
60+
(300, 200), dst=f"{dst_bucket}/image_resize_transformed/"
5961
)
6062
df_image["normalized"] = df_image["image"].blob.image_normalize(
6163
alpha=50.0,
6264
beta=150.0,
6365
norm_type="minmax",
64-
dst="gs://bigframes_blob_test/image_normalize_transformed/",
66+
dst=f"{dst_bucket}/image_normalize_transformed/",
6567
)
6668

6769
# You can also chain functions together
6870
df_image["blur_resized"] = df_image["blurred"].blob.image_resize(
69-
(300, 200), dst="gs://bigframes_blob_test/image_blur_resize_transformed/"
71+
(300, 200), dst=f"{dst_bucket}/image_blur_resize_transformed/"
7072
)
7173
df_image
7274
# [END bigquery_dataframes_multimodal_dataframe_image_transform]

0 commit comments

Comments
 (0)