DEV Community

fadingNA
fadingNA

Posted on

Document API Update on Graddio

Overview

  • Hey everyone! This last week, I had the chance to dive into the world of gradio and contribute to improving its documentation. It was a fun experience, so I thought I'd share what I learned and how it all went down.

    GitHub logo gradio-app / gradio

    Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!

    English | δΈ­ζ–‡

    Gradio: Build Machine Learning Web Apps β€” in Python

    Gradio is an open-source Python package that allows you to quickly build a demo or web application for your machine learning model, API, or any arbitrary Python function. You can then share a link to your demo or web application in just a few seconds using Gradio's built-in sharing features. No JavaScript, CSS, or web hosting experience needed!

    It just takes a few lines of Python to create your own demo, so let's get started πŸ’«

    Installation

    Prerequisite: Gradio 5 requires Python 3.10 or higher

    We recommend installing Gradio using pip, which is included by default in Python. Run this in your terminal or command prompt:

    pip install --upgrade gradio
    Enter fullscreen mode Exit fullscreen mode

    Tip

    It is best to install Gradio in a virtual environment. Detailed installation instructions for all…

Issue

Buttons of type 'huggingface' appear Black #9787

Describe the bug

When not in darkmode, 'huggingface buttons appear black with white text. When in darkmode they appear white. This is in contrary to the documentation. And in contrary to how they worked in gradio 5.1.0.

Have you searched existing issues? πŸ”Ž

  • [X] I have searched and found no existing issues

Reproduction

import numpy as np
import gradio as gr

with gr.Blocks() as demo:
    text_button = gr.Button("I Am a Button", variant='huggingface')


if __name__ == "__main__":
    demo.launch()
Enter fullscreen mode Exit fullscreen mode

Screenshot

image

Logs

No response

System Info

gradio 5.3.0
Enter fullscreen mode Exit fullscreen mode

Severity

I can work around it

  • It all started when a new issue popped up in the Gradio repository someone noticed that the 'huggingface' variant of the button component was showing up with a black background and white text when not in dark mode. This was different from how the documentation described it and even how it looked in Gradio 5.1.0. You can see the original issue

Pull Request

update docstring for the the "variant" parameter in `gr.Button` #9806

Description

Align parameter document of button api reference

🎯 PRs Should Target Issues

Closes: #9787

Tests

All tests pass.

  • Its turn out this PR is totally different from what I have done from first to last one, this one I just simply update API document to acting the correct behaviour of variant should be, but also good case to see how maintainer use the PR to make update about the API Document in the same time without create new PR seperately reduce flooding the PR for overlapping another un merge PR.

What I learned

  • Communication is Key - The conversation between the contributor and the maintainers was open and clear, which made it easy to understand what needed to be fixed. It’s a reminder of how valuable it is to reach out and ask questions.

Top comments (0)