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

Major issue: gr.Dropdown() has weird behavior with tuples #6707

Closed
1 task done
sbarman-mi9 opened this issue Dec 8, 2023 · 2 comments
Closed
1 task done

Major issue: gr.Dropdown() has weird behavior with tuples #6707

sbarman-mi9 opened this issue Dec 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@sbarman-mi9
Copy link

Describe the bug

Hi,

As we know, it's possible to pass tuples (name, value) as choices in dropdown component.

If we select an option, then we open the dropdown list again, and click outside dropdown, it passes the name instead of value, then removes the selected option from display. Please see the video for complete details.

Expected behavior:

  1. It should retain the previously selected value
  2. Should pass value instead of name

Thanks.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr


choices = [
    ("apple", 1),
    ("banana", 2),
    ("orange", 3),
    ("pear", 4),
    ("strawberry", 5)
]

with gr.Blocks() as demo:
    drpDown = gr.Dropdown(choices=choices, label="Fruit", value=1, interactive=True)

    @drpDown.input(inputs=[drpDown], outputs=None)
    def handle_dropdown_change(value):
        gr.Info(str(value))

demo.queue(default_concurrency_limit=13).launch(server_name='0.0.0.0', server_port=7860)

Screenshot

dropdown_issue.mp4

Logs

No response

System Info

gradio==4.7.1

Severity

Blocking usage of gradio

@sbarman-mi9 sbarman-mi9 added the bug Something isn't working label Dec 8, 2023
@freddyaboulton
Copy link
Collaborator

HI @sbarman-mi9 ! This got fixed yesterday in #6694 . Will be out in the next release!

@sbarman-mi9
Copy link
Author

Thanks @freddyaboulton

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

2 participants