Skip to content

Support trackio.Table with trackio.Image columns#328

Merged
abidlabs merged 25 commits into
mainfrom
fix-327
Nov 4, 2025
Merged

Support trackio.Table with trackio.Image columns#328
abidlabs merged 25 commits into
mainfrom
fix-327

Conversation

@abidlabs
Copy link
Copy Markdown
Member

@abidlabs abidlabs commented Nov 3, 2025

Adds support for trackio.Image objects in trackio.Table columns. Images are properly serialized and displayed as markdown thumbnails in the dashboard UI. Closes: #327

Test with: examples/table/table-with-images.py

image

Enables trackio.Table to contain trackio.Image objects which are displayed as markdown thumbnails in the UI. Images are properly serialized and saved to the filesystem before table storage.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gradio-pr-bot
Copy link
Copy Markdown
Contributor

gradio-pr-bot commented Nov 3, 2025

🪼 branch checks and previews

Name Status URL
🦄 Changes detected! Details

@gradio-pr-bot
Copy link
Copy Markdown
Contributor

gradio-pr-bot commented Nov 3, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
trackio patch

  • Support trackio.Table with trackio.Image columns

✅ Changeset approved by @abidlabs

  • Maintainers can remove approval by unchecking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

abidlabs and others added 17 commits November 3, 2025 14:05
Images in tables now use /gradio_api/file= format for proper display instead of broken relative paths.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Set datatype="markdown" for the whole table instead of per-column when images are present.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Refactors table media processing to keep related functionality together:
- Renames _process_media_in_dataframe to _serialize_media
- Adds Table.to_display_format() static method for UI rendering
- Removes duplicate UI processing function
- Adds _has_media_objects() helper method
- Includes comprehensive tests for new methods

This reduces coupling between Table serialization and UI display logic.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removes unnecessary has_images detection and always sets datatype="markdown" for tables.
This simplifies the API and code without any functional loss since markdown works fine
for regular text content too.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Major simplification that removes the need for _original_dataframe by:
- Always storing dataframe directly in self.data during __init__
- Using _process_data() method that checks for media objects on-demand
- Fast path for tables without media objects
- Unified processing logic in _to_dict()

This eliminates duplicate dataframe storage and complex initialization logic
while maintaining the same functionality.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Final improvements to the Table class:
- Always store data as DataFrame internally (unified representation)
- Make _to_dict project/run parameters required for explicit media handling
- Add fast path optimization to to_display_format for tables without images
- Update all tests to work with the new unified approach

This eliminates all type checking complexity and provides optimal performance.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@abidlabs abidlabs marked this pull request as ready for review November 3, 2025 23:26
Copy link
Copy Markdown
Collaborator

@Saba9 Saba9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! It might be worthwhile to update the docs for Table to mention image support.

@abidlabs
Copy link
Copy Markdown
Member Author

abidlabs commented Nov 4, 2025

This is great! It might be worthwhile to update the docs for Table to mention image support.

Done, thanks @Saba9!

@abidlabs abidlabs merged commit 6857cbb into main Nov 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support trackio.Table with trackio.Image columns

4 participants