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

Add styles to gallery component #3586

Merged
merged 67 commits into from
Apr 6, 2023
Merged

Add styles to gallery component #3586

merged 67 commits into from
Apr 6, 2023

Conversation

dawoodkhan82
Copy link
Collaborator

Description

  • Adds ability to specify columns + rows of the gallery grid
  • Adds ability to specify object-fit css variable for thumbnail images. This might be too specific, so open to feedback on whether we should include this. But it was requested, so thought I would add it to this PR

Please include:

  • relevant motivation
  • a summary of the change
  • which issue is fixed.
  • any additional dependencies that are required for this change.

Closes: #3385

Checklist:

  • I have performed a self-review of my own code
  • I have added a short summary of my change to the CHANGELOG.md
  • My code follows the style guidelines of this project
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

A note about the CHANGELOG

Hello 👋 and thank you for contributing to Gradio!

All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.

Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.

@dawoodkhan82 dawoodkhan82 requested review from aliabid94 and pngwn March 22, 2023 18:09
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Mar 22, 2023

🎉 The demo notebooks match the run.py files! 🎉

@gradio-pr-bot
Copy link
Collaborator

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-3586-all-demos

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.

We can't remove grid right now as that would be a breaking change. Is there a way to add the new functionality while keep grid?

@dawoodkhan82
Copy link
Collaborator Author

@pngwn good point. grid is essentially number of columns, i guess we could leave it named as grid and still have grid_rows and object-fit as new style params.

@abidlabs
Copy link
Member

I find the name grid very confusing for this parameter. The parameters rows and columns are more intuitive, but since we've already released with grid, we need to keep it for backwards compatibility. How about we start a deprecation process:

  • Let's create parameters rows and columns
  • Let's keep the grid parameter, and if a user provides it, then it should be mapped to columns (but a warning should be raised saying that the parameter has been renamed to columns and it will be deprecated in the future
  • In the docstring for grid, we should also note that it's been renamed to columns

freddyaboulton and others added 20 commits March 29, 2023 11:26
* Add name + test

* Add theme names

* CHANGELOG

* Delete theme in interface
* Add event

* Add unit test

* CHANGELOG
* placeholder

* changelog

* added to readme

* client

* implement futures

* utils

* scripts

* lint

* reorg

* scripts

* serialization

* cleanup

* fns

* serialize

* cache

* callbacks

* updates

* formatting

* packaging

* requirements

* remove changelog

* client

* access token

* formatting

* deprecate

* format backend

* client replace

* updates

* moving from utils

* remove code duplication

* rm duplicates

* simplify

* galleryserializer

* serializable

* load serializers

* fixing errors

* errors

* typing

* tests

* changelog

* lint

* fix lint

* fixing files

* formatting

* type

* fix type checking

* changelog

* changelog

* Update client/python/gradio_client/client.py

Co-authored-by: Lucain <lucainp@gmail.com>

* formatting, tests

* formatting, tests

* gr.load

* refactoring

* refactoring'

* formatting

* formatting

* tests

* tests

* fix tests

* cleanup

* added tests

* adding scripts

* formatting

* address review comments

* readme

* serialize info

* remove from changelog

* version 0.0.2 released

* lint

* type fix

* check

* type issues

* hf_token

* update hf token

* telemetry

* docs, circle dependency

* hf token

* formatting

* updates

* sort

* script

* external

* docs

* formatting

* fixes

* scripts

* requirements

* fix tests

* context

* changes

* formatting

* fixes

* format fix

---------

Co-authored-by: Lucain <lucainp@gmail.com>
* Translate or for i18n

* CHANGELOG
* fix

* changelog

* blocks

* formatting
* analytics

* changelog

* remove interface analytics

* ip

* remove import

* format

* theme name

* theme analytics

* format

* changelog

* fixes

* format

* remove unused param

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* simplify tests

* imports

* imports

* formatting

* removed cometml typing

* simplify

* changelog
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* fixes

* remove binaries

* doc

* changelog

* typing

* run on windows

* cancels

* added clarifications
* Add docs for flagging

* Fix params

* CHANGELOG

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
* ensure css loads before mounting app

* changelog

* fix tests

* change?

* changelog
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
* fixes

* changelog

* Update gradio/components.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update CHANGELOG.md

* Update CHANGELOG.md

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Add Windows CI

* Update changelog

* fix

* Skip one test on Windows

* Preserve virtualenv path

* Skip another test on Windows

* Make conditional flaky

* Requested changes

* consistent os

* cleanup

* fix test for windows

* remove unnecessary check

* lint

* lint

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* move files

* commit the rest of the files

* fix lockfile

* fix workflow

* fix type errors

* fix tests

* only run ci when certain files change

* run correct test command in ci

* version

* fix pypi script

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Support empty lists being used in `gr.Dataframe`

* Update changelog

* Add empty dataframe test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* fix windows flake

* format backend

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
* Raise Error

* CHANGELOG

* Add progress tracking validate_queue_settings

* Update gradio/blocks.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Fix test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* dockerfile

* copy everything from repo

* correct dir

* changelog
aliabid94 and others added 25 commits April 5, 2023 15:46
* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* Update CHANGELOG.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update gradio/themes/builder.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* changes

* changes

* Update version.txt
* [create-pull-request] automated change

* fix changelog

---------

Co-authored-by: abidlabs <abidlabs@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* changes

* changes

* changes

* changelog

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* [create-pull-request] automated change

* Trigger Build

---------

Co-authored-by: aliabd <aliabd@users.noreply.github.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
* Fix mapping and test

* Bump gradio version

* Revert gradio version bump
* client format

* docs

* formatting

* fix tests

* fixed bug

* api endpoint changes

* fix tests

* fix tests

* formatting

* Add support for sessions [python client] (#3731)

* client

* add state and tests

* remove session param
* bundle js client + gen types

* changeset

* changeset

* fix bugs

* fix deps

* fix deps

* format

* fix ci

* fix types
* Support IPv6 addresses for --server-name

* Update changelog now that I have a PR number.

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
* increase timeout

* merge

* Add changelog

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
* Sort requirements.in

* Switch flake8 + isort to ruff

* Apply ruff import order fixes

* Fix ruff complaints in demo/

* Fix ruff complaints in test/

* Use `x is not y`, not `not x is y`

* Remove unused listdir from website generator

* Clean up duplicate dict keys

* Add changelog entry

* Clean up unused imports (except in gradio/__init__.py)

* add space

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Move documentation for _js into docstring, not a stray comment

* Add missing argument docstrings (and remove non-existent ones)

* Add changelog entry

* updated docstrings

* changelog

* contributors

* changelog

* formatting

* removed _js

---------

Co-authored-by: Aarni Koskela <akx@iki.fi>
* Fix typing extensions

* Import typing_extensions

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Access unsecure token

* CHANGELOG

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Add root_url to serializers

* Add url fix

* Respect fn parameter

* Fix docstring

* Add other test

* Pass to method
* release action

* fixes

* name

* Update version.txt

* Update version.txt

* update

* fixes

* version

* rename

* action

* fix token

* custom dir

* fixes

* change password

* revert back to token

* scripts

* remove twine
* Add status + unit test (flaky) for now

* Install client

* Fix tests

* Lint backend + tests

* Add non-queue test

* Fix name

* Use lock instead

* Add simplify implementation + fix tests

* Restore changes to scripts

* Fix README typo

* Fix CI

* Add intermediate results to python client

* Type check

* Typecheck again

* Catch exception:

* Thinking

* Dont read generator from config

* add no queue test

* Remove unused method

* Fix types

* Remove breakpoint

* Fix code

* Fix test

* Fix tests

* Unpack list

* Add docstring

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
* Add iterator

* Break if done

* Add test for early termination
@dawoodkhan82
Copy link
Collaborator Author

@pngwn good to merge?

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 good!

@dawoodkhan82 dawoodkhan82 merged commit 88a487c into main Apr 6, 2023
@dawoodkhan82 dawoodkhan82 deleted the gallery-style branch April 6, 2023 16:38
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.

More control over the style of gr.Gallery