Skip to content

Commit e0e5282

Browse files
committed
Updated doc of image from bytes
1 parent fe9e30a commit e0e5282

5 files changed

Lines changed: 25 additions & 2 deletions

File tree

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"Bash(pnpm run lint:*)",
2121
"Bash(pnpm typecheck:*)",
2222
"Bash(pnpm tsc:*)",
23-
"Bash(make lint:*)"
23+
"Bash(make lint:*)",
24+
"Bash(grep:*)"
2425
],
2526
"deny": [],
2627
"ask": []

data/images.parquet

2.51 MB
Binary file not shown.

landing/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export CLOUDFLARE_ACCOUNT_ID := 41a336bea9a67c844e5fcba526c53768
2+
13
env:
24
pnpm install
35

landing/public/content/docs/configuration.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ Here is one example:
2424

2525
Note that the relative path must **start with `./`** and absolute path must start with `/`.
2626

27+
### Media bytes in HuggingFace format
28+
If your data contains media bytes (e.g. from HuggingFace datasets), SmooSense can render them directly. The column value should be a dict with `bytes` and `path` fields:
29+
30+
```python
31+
{"bytes": b"\x89PNG...", "path": "image.png"}
32+
```
33+
34+
SmooSense automatically detects this format and converts the bytes to a displayable media element. This works for images, audio, and video. It is the standard format used by HuggingFace `datasets` library for image and audio columns.
35+
36+
> The `path` field **must** have a recognized file extension (e.g. `.jpg`, `.png`, `.mp4`, `.wav`). SmooSense uses it to determine the MIME type and how to render the media. Without a valid extension, the content will not be displayed.
37+
38+
2739
### Public url
2840
For public data, you can expose them as urls and put the url in table cells. For example:
2941

@@ -68,8 +80,15 @@ Below is an example for CloudFlare R2 storage:
6880
AWS_ENDPOINT_URL=https://<account-id>.r2.cloudflarestorage.com AWS_PROFILE=r2 sense
6981
```
7082

83+
84+
## Customized private urls
85+
If you data is private, you can run an API to proxy the url.
86+
On the server side, use cookie to authenticate requests.
87+
88+
Make sure the url ends with an image extension (e.g. `.jpg`) for it to be treated as image url. The same for video.
89+
7190
## Run with a specific port number and url prefix
7291

7392
```bash
7493
sense --port 8888 --url-prefix /subpath
75-
```
94+
```

smoosense-py/dummy_data/various_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def generate(self):
4242
"s3_url": f"s3://smoosense-demo/images/sizes/{image_file.name}",
4343
"rel_url": f"./images/{image_file.name}",
4444
"image_bytes": image_bytes,
45+
"hf_image": {"bytes": image_bytes, "path": image_file.name},
4546
"width": width,
4647
"height": height,
4748
"size": size,

0 commit comments

Comments
 (0)