Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DF Postprocess for tuples #10548

Merged
merged 4 commits into from
Feb 10, 2025
Merged

Fix DF Postprocess for tuples #10548

merged 4 commits into from
Feb 10, 2025

Conversation

freddyaboulton
Copy link
Collaborator

Description

Fixing tiny bug in df postprocess. See discord

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Testing and Formatting Your Code

  1. PRs will only be merged if tests pass on CI. We recommend at least running the backend tests locally, please set up your Gradio environment locally and run the backed tests: bash scripts/run_backend_tests.sh

  2. Please run these bash scripts to automatically format your code: bash scripts/format_backend.sh, and (if you made any changes to non-Python files) bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 8, 2025

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/3c0ca36687e1f553d0bfb6ff85e537c5471c4eaa/gradio-5.15.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@3c0ca36687e1f553d0bfb6ff85e537c5471c4eaa#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/3c0ca36687e1f553d0bfb6ff85e537c5471c4eaa/gradio-client-1.11.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/3c0ca36687e1f553d0bfb6ff85e537c5471c4eaa/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 8, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fix DF Postprocess for tuples

Maintainers or the PR author can modify the PR title to modify this entry.

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.

@freddyaboulton freddyaboulton added v: patch A change that requires a patch release t: fix A change that implements a fix labels Feb 8, 2025
@freddyaboulton freddyaboulton marked this pull request as ready for review February 8, 2025 00:40
@abidlabs
Copy link
Member

lgtm! Tested with:

import gradio as gr
from collections import namedtuple

json_data = [
    # Frame 1
    (1, 1, 1, 150.5, 200.3),
    (1, 2, 0, 320.1, 180.7),
    (1, 3, 1, 90.4, 250.2),
    
    # Frame 2
    (2, 1, 1, 155.2, 205.8),
    (2, 2, 0, 318.9, 182.1),
    (2, 3, 1, 95.7, 248.9),
    
    # Frame 3
    (3, 1, 1, 160.8, 208.4),
    (3, 2, 0, 315.5, 185.3),
    (3, 3, 1, 98.2, 245.6),
    
    # Frame 4
    (4, 1, 1, 165.3, 212.7),
    (4, 2, 0, 312.8, 187.9),
    (4, 3, 1, 102.5, 242.1)
]

points_list = []
DataPoint = namedtuple("DataPoint", ["Frame", "ObjectID", "Positive", "X", "Y"])
points_list = [DataPoint(*point) for point in json_data] 


with gr.Blocks() as demo:
    point_viewer = gr.List(
                        headers=["Frame", "ObjectID", "Positive", "X", "Y"],
                        datatype=["number", "number", "number", "number", "number"],
                        value=points_list,
                        col_count=5)

demo.launch()

@freddyaboulton
Copy link
Collaborator Author

Thank you!

@freddyaboulton freddyaboulton merged commit bcbb7b6 into main Feb 10, 2025
22 checks passed
@freddyaboulton freddyaboulton deleted the fix-df-postprocess-bug branch February 10, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: fix A change that implements a fix v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants