Add info to docs on how to set default values for components#1788
Merged
Conversation
freddyaboulton
commented
Jul 13, 2022
| txt = gr.Textbox(label="Input", lines=2) | ||
| txt_2 = gr.Textbox(label="Input 2") | ||
| txt_3 = gr.Textbox("", label="Output") | ||
| btn = gr.Button("Submit") |
Collaborator
Author
There was a problem hiding this comment.
In the original issue, the discord user said he couldn't find demos using value despite it being used in demos already.
I figured that was because we didn't set it explicitly with a keyword argument so I went through some demos and set value via keyword arg.
freddyaboulton
commented
Jul 13, 2022
| @@ -0,0 +1,18 @@ | |||
| import gradio as gr | |||
Collaborator
Author
There was a problem hiding this comment.
Adding another demo that sets the default value on the image since there wasn't an example doing that already and that was mentioned on the discord.
freddyaboulton
commented
Jul 13, 2022
Member
|
LGTM! |
abidlabs
approved these changes
Jul 19, 2022
omerXfaruq
approved these changes
Jul 19, 2022
Contributor
omerXfaruq
left a comment
There was a problem hiding this comment.
LGTM!
You might want to change demo/image_mod_default_image/screenshot.png with a 10KB file instead of 1MB with git soft reset to not increase git size.
ff46797 to
e7f5069
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes: #1688
Went about this by setting
valuevia keyword arg in the examples and adding a section to the blocks guide about default valuesChecklist: