-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove style parameter #4374
Remove style parameter #4374
Conversation
🎉 The demo notebooks match the run.py files! 🎉 |
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4374-all-demos |
We will need to merge this into the 4.0 branch as it is a breaking change. |
it's not breaking, it gives warnings but still works. Would be good to get this into main asap because it touches so many files, so it will get stale quickly. |
Ah okay. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested as much as I could and lgtm! But we should wait until @dawoodkhan82 has tested as well.
Some issues I noticed:
import gradio as gr
def test(x):
return x
with gr.Blocks() as demo:
a = gr.Textbox(show_copy_button=True)
b = gr.Textbox(show_copy_button=True)
a.change(test, a, b)
demo.launch()
import gradio as gr
def test(x):
return x
with gr.Blocks() as demo:
a = gr.Textbox(show_copy_button=True)
b = gr.Chatbot(height=10)
a.change(test, a, b)
demo.launch()
import gradio as gr
def test(x):
return "lion.jpg"
with gr.Blocks() as demo:
a = gr.Textbox()
b = gr.Image(height=10, width=200)
a.change(test, a, b)
demo.launch() Updated the parent comment to also say that this closes #2395 :) |
Regarding #2395, do they actually work if you update them? |
Fixed everything @abidlabs, can test with this: import gradio as gr
with gr.Blocks() as demo:
a = gr.Textbox(show_copy_button=True)
b = gr.Textbox(show_copy_button=True)
img = gr.Image(height=200, width=200)
img_size = 200
grow_btn = gr.Button("Grow Image")
def grow_image():
global img_size
img_size += 100
return gr.Image.update(width=img_size, height=img_size)
grow_btn.click(grow_image, None, img)
chat = gr.Chatbot([["hello", "hi"], ["hi", "hello"]], height=240)
a.change(test, a, b)
demo.launch()
Yes, can test using the demo above as well |
Tested this pretty extensively, both the deprecated & new versions work quite well! A couple of small issues:
import gradio as gr
with gr.Blocks() as demo:
c = gr.Textbox("cheetah.jpg", show_copy_button=True)
demo.load(lambda :gr.update(show_copy_button=False), None, c)
demo.launch()
import gradio as gr
with gr.Blocks() as demo:
c = gr.Gallery(["cheetah.jpg"]*6, preview=False, grid_cols=2)
demo.load(lambda :gr.update(height=100), None, c)
demo.launch() Good to go once these are fixed! |
Fixed
Fixed and changed names. |
Wanted to get this cleanup out of the way before starting 4.0 stuff.
.style
paramater, moved arguments to constructor.update
supports all arguments formerly in stylescale
andmin_width
can be applied directly to any component, rather than requiring a Column nesting that would break aligned widths and other issues.Closes: #2395