Allow gr.Templates to take in arguments#2600
Conversation
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2600-all-demos |
| @@ -97,7 +106,9 @@ class Pil(components.Image): | |||
| is_template = True | |||
|
|
|||
| def __init__(self, **kwargs): | |||
There was a problem hiding this comment.
Wouldn't it be better if we specified the kwargs the class supports as opposed to accepting arbitrary kwargs?
Right now you could do gr.Pil(type="numpy") which is confusing/defeats the purpose of the template. Also means devs won't get hints from their editors and makes it easy to make a typo and only be aware at runtime.
There was a problem hiding this comment.
Ah yeah you're right. I think it's okay to override the template params but you're right it would be good to specify them explicitly
|
Fixed now, thanks for the suggestion @freddyaboulton! |
freddyaboulton
left a comment
There was a problem hiding this comment.
Thank you for the fix @abidlabs !
A fix to
gr.Templatesso that they can take in arguments. Fixes: #2595