Skip to content
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

make custom component parameters change during runtime #9745

Open
1 task done
lth-mettadepth opened this issue Oct 17, 2024 · 0 comments
Open
1 task done

make custom component parameters change during runtime #9745

lth-mettadepth opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working custom-components Related to custom component cli or workflow

Comments

@lth-mettadepth
Copy link

Describe the bug

Hi team,

I had created several gradio custom components, during working progress, and I'm encountering issue that several parameters could be change by interactive (like change width, height,... from textbox, or click on a button to change param from False to True ) while some could not change. I tried many solution to make effect from the UI but seem it not work.

Could you explain why this is happening ? What is potential causing this issue ?

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
import gradio_htmleditor as HTMLEditor

def toggle_interactive(content, make_interactive):
    return gr.update(interactive=make_interactive)

with gr.Blocks(theme="Soft") as demo:
    with gr.Column(variant="panel"):
        html = gr.HTML(value="Test HTML")
        editor = HTMLEditor(
            value=example,
            interactive=True,
            show_label=True,
            label="HTML Editor Component",
            hide_tools=[],
            statusbar=True,
        )
        print_btn = gr.Button(value="Print HTML")
        print_btn.click(fn=print_html, inputs=editor)

        set_value_btn = gr.Button("Set Value")
        set_value_btn.click(fn=set_value, inputs=None, outputs=[editor])

        make_interactive = gr.Button(value="Make Interactive")
        make_readonly = gr.Button(value="Make Read Only")

        make_interactive.click(
            fn=toggle_interactive,
            inputs=[editor, gr.Checkbox(value=True, visible=False)],
            outputs=editor,
        )
        make_readonly.click(
            fn=toggle_interactive,
            inputs=[editor, gr.Checkbox(value=False, visible=False)],
            outputs=editor,
        )

if __name__ == "__main__":
    demo.launch()

Screenshot

No response

Logs

No response

System Info

gradio==4.44.1
python==3.10

Severity

I can work around it

@lth-mettadepth lth-mettadepth added the bug Something isn't working label Oct 17, 2024
@abidlabs abidlabs added the custom-components Related to custom component cli or workflow label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working custom-components Related to custom component cli or workflow
Projects
None yet
Development

No branches or pull requests

2 participants