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

Ensure source selection does not get hidden in overflow #6279

Merged
merged 22 commits into from Nov 7, 2023

Conversation

hannahblair
Copy link
Collaborator

@hannahblair hannahblair commented Nov 3, 2023

Description

Fixes the overflow of the source selection element in video and audio.

Screenshot 2023-11-06 at 19 31 32
import gradio as gr

with gr.Blocks() as demo:
    with gr.Row():
        input_video = gr.Video(label="Input Video1", sources=["webcam", "upload"],  interactive=True, height=400)
        output = gr.Video(label="Output Video1", height=250)

    with gr.Row():
        input_video = gr.Audio(label="Input Audio", sources=["upload", "microphone"])
        output = gr.Audio(label="Output Audio", sources=["upload", "microphone"])

if __name__ == "__main__":
    demo.launch()

Closes: #6258

🎯 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.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 3, 2023

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
Visual tests all good! Build review
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/c66ea0328e088a5387350d556912928edafd0049/gradio-4.1.1-py3-none-any.whl

Install Gradio Python Client from this PR

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

{waveform_settings}
{handle_reset_value}
/>
<div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you know why the overflow started happening in the first place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I should've marked this as draft because this shouldn't be the fix really. Here's the space with the first implementation of it working fine and it didn't need this wrapper

Copy link
Member

Choose a reason for hiding this comment

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

Meant to ask this here:

Does the image already do this? Is this not something that Block in atoms can solve?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tried a few things to address it with Block but ultimately the issue is with the Upload button pushing out the source selection component in certain heights

js/video/Video.stories.svelte Outdated Show resolved Hide resolved
@hannahblair hannahblair marked this pull request as draft November 3, 2023 14:15
@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Nov 3, 2023

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/atoms patch
@gradio/audio patch
@gradio/upload patch
@gradio/video patch
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Ensure source selection does not get hidden in overflow

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.

@hannahblair hannahblair changed the title Add div wrapper around content and source selection Ensure source selection component does not get hidden in overflow Nov 6, 2023
@hannahblair hannahblair changed the title Ensure source selection component does not get hidden in overflow Ensure source selection does not get hidden in overflow Nov 6, 2023
@hannahblair hannahblair marked this pull request as ready for review November 6, 2023 18:36
@@ -0,0 +1,74 @@
<script lang="ts">
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

these changes are just moving the source selection over to a reusable component

@@ -94,6 +95,7 @@
class:center
class:boundedheight
class:flex
style:height={include_sources ? "calc(100% - 40px" : "100%"}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the actual fix for the issue

@@ -227,6 +228,7 @@
bind:dragging
on:error={({ detail }) => dispatch("error", detail)}
{root}
include_sources={sources.length > 1}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure if there's a better name for this param

Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for taking care of this @hannahblair!

@hannahblair hannahblair merged commit 3cdeabc into main Nov 7, 2023
20 checks passed
@hannahblair hannahblair deleted the fix-source-styling branch November 7, 2023 10:58
@pngwn pngwn mentioned this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio does not display source selection in the same box as the media
4 participants