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

dropdown becomes inconsistent with change effects #5582

Closed
1 task done
pseudotensor opened this issue Sep 18, 2023 · 2 comments
Closed
1 task done

dropdown becomes inconsistent with change effects #5582

pseudotensor opened this issue Sep 18, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pseudotensor
Copy link
Contributor

pseudotensor commented Sep 18, 2023

Describe the bug

When over internet connection (not local) there is a 0.5s-1s delay in the change operation, and if user changes the dropdown on a shorter timescale, then the effects are somehow not queued in sequence properly and the UI state becomes inconsistent with the cumulative changes.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

  • Need to run over slower internet, like server in India and UI in USA, or go over slow connection to mimic.
  • Run script
  • Do what video shows, by quickly deselecting some, see how not consistent in end.
  • Worse when there is queue of events, so lag is even longer
import random
import time

import gradio as gr


def sentence_builder(quantity, animal, countries, place, activity_list, morning):
    return f"""The {quantity} {animal}s from {" and ".join(countries)} went to the {place} where they {" and ".join(activity_list)} until the {"morning" if morning else "night"}"""


demo = gr.Blocks()

with demo:
    num = 10
    choices = [str(x) for x in list(range(0, num))]
    choices0 = [str(x) for x in list(range(0, num - 1))]
    vis_list = gr.Dropdown(
        choices,
        value=choices0,
        multiselect=True,
        label="Model",
    )

    msg = gr.Textbox()

    def respond(*args):
        message = args[0]
        chat_historys = args[1:]
        bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
        for chat_history in chat_historys:
            chat_history.append((message, bot_message))
        time.sleep(2)
        return tuple(chat_historys)

    chatbots = [gr.Chatbot(visible=str(x) in choices0, label=str(x)) for x in range(0, num)]
    msg.submit(respond, [msg] + chatbots, chatbots)

    def vis_change(vis_list1):
        vis_list1 = [int(x) for x in vis_list1]
        ret_list = [gr.update(visible=xi in vis_list1) for xi in list(range(0, 10))]
        return tuple(ret_list)
    vis_list.change(vis_change, inputs=vis_list, outputs=chatbots)
demo.queue()
demo.launch(server_name='0.0.0.0')

Screenshot

vokoscreenNG-2023-09-17_22-04-18.mp4

Logs

Not quite blocking all usage, but leads to poor UX.

System Info

gradio==3.41.0
gradio_client==0.3.0

Severity

Blocking usage of gradio

@pseudotensor pseudotensor added the bug Something isn't working label Sep 18, 2023
@abidlabs
Copy link
Member

This is actually the same issue as #1954 -- we'll fix this in 4.0 @pseudotensor

@abidlabs
Copy link
Member

Fixed in v4 branch, thanks @dawoodkhan82!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants