gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
34.22k stars 2.6k forks source link

[ImageEditor] Can't switch brush color when custom colors specified #9105

Closed halleewong closed 2 hours ago

halleewong commented 3 months ago

Describe the bug

Changing brush colors does not work when specifying custom brush colors. Tried setting the brush color_mode to fixed or defaults and it doesn't make any difference.

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    gr.ImageEditor(
        brush=gr.Brush(colors=["#00FF00", "#FF0000"], color_mode='fixed'),
    )
demo.launch()

Screenshot

The palette shows both colors but when I click on the second color it doesn't change the brush color

https://github.com/user-attachments/assets/bcac9054-a013-44c7-8482-9ad880eb3a14

Logs

No response

System Info

Using clean conda environment created with:

conda create --name gradioenv python=3.9
conda activate gradioenv
pip install gradio

Versions:
gradio=4.41.0 
gradio_client=1.3.1
python=3.9.19

Severity

Blocking usage of gradio

qingqinggu commented 3 months ago

I also meet this problem

2ndpic commented 2 months ago

please fix the bug, I aslo meet

AlicanAKCA commented 2 months ago

I think there is a problem with updating or selecting colors. You can check it after here . Repeatedly selects the first color as the default one when called.

missionfloyd commented 2 months ago

The problem seems to start at 4.39.0. 4.38.1 works correctly. Perhaps something related to #8802?

AlicanAKCA commented 2 months ago

I am getting an error when I use the gradio version 4.38.1 which is related with pydantic:

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'starlette.requests.Request'>. Set arbitrary_types_allowed=True in the model_config to ignore this error or implement __get_pydantic_core_schema__ on your type to fully support it

nrailg commented 2 months ago

Same problem here.

Falling back to 4.38.1 fixed this problem.

fffiloni commented 5 days ago

+1 you can observe the behavior on the gradio playground