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.06k stars 2.59k forks source link

Slider fails to render CSS when values are negative #9986

Closed flacomalone closed 1 day ago

flacomalone commented 2 days ago

Describe the bug

The slider component does not render the adjustable bar accent color accordingly. This just happens with negative data ranges, not with positive.

NOTICE: I'm using my own theme, but I don't think that might be the issue

Here's an examplee of a well rendering positive data range:

        noise_threshold = gr.Slider(
            label="Silence threshold",
            value=40,
            minimum=0,
            maximum=1000,
            interactive=True
        )

image

And this is an example of exactly the same code but with a negative data range:

        noise_threshold = gr.Slider(
            label="Silence threshold",
            value=-40,
            minimum=-100,
            maximum=0,
            interactive=True
        )

image

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

with gr.Blocks() as demo:
        slider_positive = gr.Slider(
            label="Positive range",
            value=40,
            minimum=0,
            maximum=100,
            interactive=True
        )
        slider_negative = gr.Slider(
            label="Negative range",
            value=-40,
            minimum=-100,
            maximum=0,
            interactive=True
        )
demo.queue()
demo.launch()

Screenshot

No response

Logs

No response

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 5.5.0
gradio_client version: 1.4.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.6.2.post1
audioop-lts is not installed.
fastapi: 0.115.5
ffmpy: 0.4.0
gradio-client==1.4.2 is not installed.
httpx: 0.27.2
huggingface-hub: 0.26.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 2.1.3
orjson: 3.10.11
packaging: 24.2
pandas: 2.2.3
pillow: 11.0.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart==0.0.12 is not installed.
pyyaml: 6.0.2
ruff: 0.7.4
safehttpx: 0.1.1
semantic-version: 2.10.0
starlette: 0.41.2
tomlkit==0.12.0 is not installed.
typer: 0.13.0
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.32.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2024.10.0
httpx: 0.27.2
huggingface-hub: 0.26.2
packaging: 24.2
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

abidlabs commented 1 day ago

Thanks for reporting @flacomalone, we'll have a fix in soon