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

Support for gradio objects as allowed types in gr.Dataframe cells #2006

Closed GuillemGSubies closed 10 months ago

GuillemGSubies commented 2 years ago

I am trying to show a Dataframe using gradio and let the user input the value for a specific cell using a dropdown menu. I tried to put dropdowns as cells but they are not picklable so it did not work.

Is there a chance of this being a feature in the future? It would be something like this:

Untitled Diagram

Thank you

abidlabs commented 2 years ago

Hi @GuillemGSubies thanks for creating an issue and including the graphic. This is quite interesting, and we can certainly think whether this in scope for the Dataframe component. Can you tell us more about the use case / model you would like to demo?

GuillemGSubies commented 2 years ago

Basically, in our use case, we need the end user to be able to apply certain model/heuristic depending on their expert point of view of the sample (row) they are analyzing.

Right now, instead of a widget we are using text input in the column B, however that is more error prone and slower

freddyaboulton commented 2 years ago

I wonder if adding this feature to a gr.Dataset would be more appropriate given that it already expects a list of components in the constructor.

pngwn commented 1 year ago

@freddyaboulton didn't see this until today but why don't we just merge Dataframe and Dataset? They're basically the same with a few features turned off. It would make supporting usecases like this much simpler too. We could still provide Dataset as a template if we think that would make sense.

abidlabs commented 1 year ago

@pngwn I don't think that would solve this specific issue though. @GuillemGSubies asked for a dropdown to be embedded inside a Dataframe. Currently, even the Dataset doesn't support a dropdown that a user can interact with -- instead it allows for a specific option of the Dropdown to be shown as text, which is very different

abidlabs commented 11 months ago

Hi! We've now made it possible for Gradio users to create their own custom components -- meaning that you can write some Python and JavaScript (Svelte), and publish it as a Gradio component. You can use it in your own Gradio apps, or share it so that anyone can use it in their Gradio apps. Here are some examples of custom Gradio components:

You can see the source code for those components by clicking the "Files" icon and then clicking "src". The complete source code for the backend and frontend is visible. In particular, its very fast if you want to build off an existing component. We've put together a Guide: https://www.gradio.app/guides/five-minute-guide, and we're happy to help if you'd like to put together a custom component for this issue

abidlabs commented 10 months ago

I'll go ahead and close this issue since we are not planning to include this in the core Gradio library. But happy to help if you are interested in making this a custom Gradio component (feel free to ask questions in this issue).