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.68k stars 2.55k forks source link

[`blocks-dev`] Default value of Checkbox does not show up #881

Closed abidlabs closed 2 years ago

omerXfaruq commented 2 years ago

Is this a checklist to mark when a component is testing for working without an issue?

abidlabs commented 2 years ago

That's honestly a good idea. Would probably subsume many of the individual issues that I created and easier to manage. Feel free to create it!

abidlabs commented 2 years ago

Not sure if this fits into this issue or a separate issue, but I noticed that the default_value for a Checkbox doesn't show up. (It does for CheckboxGroup, Radio, etc.). Try:

bl = gr.Blocks()
with bl:
    gr.Checkbox("vegetarian")

    bl.launch()
abidlabs commented 2 years ago

I don't think this issue has been that useful tbh. Renaming to only focus on the last thing that I mentioned.

abidlabs commented 2 years ago

@pngwn I think there are still some issues with Checkbox:

image

Compare with CheckboxGroup, which is behaving correctly:

image
pngwn commented 2 years ago

The label gets assigned to both the label and the associated text. The correct behavior is that the default_value parameter should be the associated text

The Checkbox seems to pass in the default_value. I think the correct behavior is that it should pass in a boolean: True or False, depending on it's checked.

I don't think this is correct unless i'm misreading the API. Checkbox only has a mechanism to pass in one 'label'. So the duplication is just because no associated text is passed in at all from the docs:

gradio.inputs.Checkbox(self, default=False, label=None, optional=False)

So passing the default_value is correct unless things have change significantly from the original API (I thought checkbox was mostly the same).

I've modified the UI a little so the Checkbox appears on its own with no additional text, this is consistent with current usage. We canm discuss if an additional piece of associated text makes sense.

abidlabs commented 2 years ago

One very small part of #897 is left:

The output textbox size does not dynamically change size according the output as it used to (see screenshot)

Here's a screenshot:

image

Everything else looks great!!

pngwn commented 2 years ago

Closed by #929.