gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.41k stars 2.53k forks source link

Make adding new components to core easier #3361

Closed pngwn closed 11 months ago

pngwn commented 1 year ago

Currently we register each component like this:

const component_directory = {
  'pycompname': () => import('....'),
  ...
}

This is kindof annoying with all of the other stuff you have to do. Need to change it. We need some magic 🪄

There are a couple of ways we can do this.

I'm thinking that components in packages can have a special field added to them if they are a gradio component and we can autogenerate everything. Then the process of adding a new component to core will just be a case of adding a new package with this fields, respecting the documented structure and nothing else.

The alternative is adding a method (which we'll need for custom components anyway), something like register` would be magical but requires more work for devs and could introduce more tooling issues (typescript in particular).

This will need some TS declaration files either way I think.

abidlabs commented 11 months ago

Was done as part of 4.0! Thanks @pngwn