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

chatbot orange border makes dropdown into it flash and flicker and chat border is above dropdown info #7368

Closed
1 task done
pseudotensor opened this issue Feb 9, 2024 · 3 comments · Fixed by #7466
Closed
1 task done
Labels
bug Something isn't working Regression Bugs did not exist in previous versions of Gradio

Comments

@pseudotensor
Copy link
Contributor

Describe the bug

The chatbot border is above the dropdown, and when chatbot is streaming the dropdown is hard to use.

Wasn't like this with gradio 3.50.2

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import time

import gradio as gr

with gr.Blocks() as demo:
    with gr.Column():
        with gr.Accordion():
            image = gr.Image()
        with gr.Tabs():
            visible_models = gr.Dropdown([str(x) for x in list(range(0, 10))],
                                                             label="Visible Models",
                                                             value=str(0),
                                                             interactive=True,
                                                             multiselect=True,
                                                             visible=True,
                                                             filterable=False,
                                                             max_choices=4,
                                                             )
            with gr.Tab("Chat"):
                chatbot = gr.Chatbot()
                msg = gr.Textbox()
                clear = gr.Button("Clear")
            with gr.Tab("Other"):
                msg2 = gr.Textbox()

    def user(user_message, history):
        return "", history + [[user_message, None]]

    def bot(history):
        history[-1][1] = ''
        for msg in range(0, 10000):
            history[-1][1] += str(msg)
            if msg % 100 == 0:
                history[-1][1] += '\n'
            time.sleep(0.01)
            yield history

    msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
        fn=bot, inputs=chatbot, outputs=chatbot, api_name='bot',
    )
    clear.click(lambda: None, None, chatbot, api_name='clear')

demo.queue()
demo.launch()

Screenshot

image

Logs

No response

System Info

gradio 4.17.0

It's not a critical bug, but UX/UI issue.  I don't have any way to work around it.

Severity

Blocking usage of gradio

@pseudotensor pseudotensor added the bug Something isn't working label Feb 9, 2024
@abidlabs abidlabs added the Regression Bugs did not exist in previous versions of Gradio label Feb 9, 2024
@abidlabs
Copy link
Member

The issue is just the orange border, right? Everything else is "ordered correctly"?

@pseudotensor
Copy link
Contributor Author

pseudotensor commented Feb 10, 2024

Yes. I think that's the only problem. I'll check if multiple chatbots flash again with repro.

@abidlabs abidlabs changed the title chatbot border makes dropdown into it flash and flicker and chat border is above dropdown info chatbot orange border makes dropdown into it flash and flicker and chat border is above dropdown info Feb 10, 2024
@pseudotensor
Copy link
Contributor Author

Ya, I think my perception of flashing was just how the chatbot appears, but it's not a bug.

import time

import gradio as gr

with gr.Blocks() as demo:
    with gr.Column():
        with gr.Accordion():
            image = gr.Image()
        with gr.Tabs():
            visible_models = gr.Dropdown([str(x) for x in list(range(0, 10))],
                                                             label="Visible Models",
                                                             value=str(0),
                                                             interactive=True,
                                                             multiselect=True,
                                                             visible=True,
                                                             filterable=False,
                                                             max_choices=4,
                                                             )
            with gr.Tab("Chat"):
                with gr.Column():
                    with gr.Row():
                        chatbot1 = gr.Chatbot(visible=True)
                        chatbot2 = gr.Chatbot(visible=False)
                with gr.Column():
                    with gr.Row():
                        chatbot3 = gr.Chatbot(visible=False)
                        chatbot4 = gr.Chatbot(visible=False)
                with gr.Column():
                    with gr.Row():
                        chatbot5 = gr.Chatbot(visible=False)
                        chatbot6 = gr.Chatbot(visible=False)
                with gr.Column():
                    with gr.Row():
                        chatbot7 = gr.Chatbot(visible=False)
                        chatbot8 = gr.Chatbot(visible=False)
                with gr.Column():
                    with gr.Row():
                        chatbot9 = gr.Chatbot(visible=False)
                        chatbot10 = gr.Chatbot(visible=False)
                msg = gr.Textbox()
                clear = gr.Button("Clear")
            with gr.Tab("Other"):
                msg2 = gr.Textbox()

    def user(user_message, history):
        return "", history + [[user_message, None]]

    def bot(history):
        history[-1][1] = ''
        for msg in range(0, 10000):
            history[-1][1] += str(msg)
            if msg % 100 == 0:
                history[-1][1] += '\n'
            time.sleep(0.01)
            yield history

    def visible_models_func(visible_models1, num_models=10):
        return [gr.Chatbot(visible=str(x) in visible_models1) for x in range(num_models)]

    visible_models.change(fn=visible_models_func,
                          inputs=visible_models,
                          outputs=[chatbot1, chatbot2, chatbot3, chatbot4, chatbot5, chatbot6, chatbot7, chatbot8, chatbot9, chatbot10],
                          )

    msg.submit(user, [msg, chatbot1], [msg, chatbot1], queue=False).then(
        fn=bot, inputs=chatbot1, outputs=chatbot1, api_name='bot',
    )
    clear.click(lambda: None, None, chatbot1, api_name='clear')

demo.queue()
demo.launch()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Regression Bugs did not exist in previous versions of Gradio
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants