Skip to content

[BIG PR] Gradio blocks & redesigned components#880

Merged
aliabid94 merged 305 commits into
mainfrom
blocks-dev
Apr 19, 2022
Merged

[BIG PR] Gradio blocks & redesigned components#880
aliabid94 merged 305 commits into
mainfrom
blocks-dev

Conversation

@abidlabs
Copy link
Copy Markdown
Member

@abidlabs abidlabs commented Mar 25, 2022

Opening this PR as a draft so that we can start thinking about merging it into main.

Of course, before we can merge it in, we need to:

  • Rewrite the core Interface class in terms of Blocks
  • Restore the full functionality of the Interface class
  • Ensure that all old python unit tests pass (for backwards compatibility)
  • Redesign all of the components (at least at a basic level -- a full redesign can come later)

abidlabs and others added 30 commits March 18, 2022 16:44
- default -> default_value refactoring
- refactor output types into output_type and make them auto
- all events are implemented
- refactor fn: str -> Callable
- add change event to TabItem
- Remove KeyValues from components
- Resolve Components imports in inputs and outputs
- fix default parameter usage in demos
- fix default parameter usage in demos
- fix default parameter usage in demos
- docstring updates
- add change event to Tabs
omerXfaruq and others added 9 commits April 15, 2022 00:24
* custom-components
- create template components
- changes in PKG and requires comes from scripts/install_gradio.sh

* custom-components
- tweaks

* update-components
- tweaks

* update-components
- fix get_block_name

* update-components
- add webcam demo

* custom-components
- make use of get_block_name function whenever possible

* custom-components
- tweaks

* refactor-component-shortcuts
- no description whatsoever :D

* refactor-component-shortcuts
- tweaks

* refactor-component-shortcuts
- create shortcut function "component"

* refactor-component-shortcuts
- reformat

* refactor-component-shortcuts
- tweaks

* refactor-component-shortcuts
- tweaks
Create Status Tracker component to report progress on function calls

Co-authored-by: Ali Abid <aliabid94@gmail.com>
* add model3D

* model3d component

* add plot component

* format

* ingnore plot.svelte from prettier

* update build script

* update circleci config

* remove circleci config change

* change build script

* remove change to build script

* remove plot.svelte

* remove duplicate save_flagged func

* fix node space issue + format issues

* Update ui.yml

* Update ui.yml

* Update ui.yml

* remove changes to config files

* updated codecov version

* Update ui.yml

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
@aliabid94 aliabid94 marked this pull request as ready for review April 19, 2022 07:30
@aliabid94 aliabid94 merged commit 9492d5a into main Apr 19, 2022
@aliabid94 aliabid94 deleted the blocks-dev branch April 19, 2022 09:24
@omerXfaruq
Copy link
Copy Markdown
Contributor

omerXfaruq commented Apr 19, 2022

@aliabid94 good job, what a big PR! How was the conflict resolving part, was it too long :D
Btw is there anything we need to review on this PR?

Comment thread gradio/inputs.py
super().__init__(default_value=default, label=label)


class Image3D(C_Model3D):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to add Image3D here? These are just for backwards compatibility.

Comment thread test/test_inputs.py
class TestImage3D(unittest.TestCase):
def test_as_component(self):
Image3D = gr.test_data.BASE64_IMAGE3D
Image3D = media_data.BASE64_MODEL3D
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is better to deepcopy test_data in case any changes occur to them.

Comment thread test/test_inputs.py

def test_in_interface(self):
Image3D = gr.test_data.BASE64_IMAGE3D
Image3D = media_data.BASE64_MODEL3D
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is better to deepcopy test_data in case any changes occur to them.

Comment thread test/test_networking.py
aiohttp.ClientSession.post.assert_called()
self.assertEqual(response.status_code, 200)
io.close()
# class TestFlagging(unittest.TestCase):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hmm, why did we comment out these tests?

Comment thread test/test_outputs.py
with tempfile.TemporaryDirectory() as tmpdirname:
to_save = Image3D_output.save_flagged(
tmpdirname, "Image3D_output", gr.test_data.BASE64_IMAGE3D, None
tmpdirname, "Image3D_output", media_data.BASE64_MODEL3D, None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is better to deepcopy test_data in case any changes occur to them.

Comment thread test/test_outputs.py
self.assertEqual("Image3D_output/0.gltf", to_save)
to_save = Image3D_output.save_flagged(
tmpdirname, "Image3D_output", gr.test_data.BASE64_IMAGE3D, None
tmpdirname, "Image3D_output", media_data.BASE64_MODEL3D, None
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is better to deepcopy test_data in case any changes occur to them.

@omerXfaruq
Copy link
Copy Markdown
Contributor

@aliabid94 this test started fail in another PR after your merge, did you had any changes about this function or data? If not it might be because of non deepcopied test_data I commented about above.

@abidlabs abidlabs mentioned this pull request Apr 19, 2022
@abidlabs
Copy link
Copy Markdown
Member Author

@aliabid94 this test started fail in another PR after your merge, did you had any changes about this function or data? If not it might be because of non deepcopied test_data I commented about above.

It was because certain files were reorganized in blocks-dev -- fixed in #1023

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.

5 participants