github gradio-app/gradio v3.2

latest releases: gradio@4.44.0, @gradio/core@0.0.4, @gradio/audio@0.13.5...
2 years ago

Here's what's new in gradio v3.2:

1. Improvements to Queuing 🥇

We've implemented a brand new queuing system based on web sockets instead of HTTP long polling. Among other things, this allows us to manage queue sizes better on Hugging Face Spaces. There are also additional queue-related parameters you can add:

  • Now supports concurrent workers (parallelization)
demo = gr.Interface(...)
demo.queue(concurrency_count=3)
demo.launch()
  • Configure a maximum queue size
demo = gr.Interface(...)
demo.queue(max_size=100)
demo.launch()
  • If a user closes their tab / browser, they leave the queue, which means the demo will run faster for everyone else

2. Fixes to Examples

  • Dataframe examples will render properly, and look much clearer in the UI: (thanks to PR #2125)

Screen Shot 2022-08-30 at 8 29 58 PM

  • Image and Video thumbnails are cropped to look neater and more uniform: (thanks to PR #2109)

Screen Shot 2022-08-30 at 8 32 15 PM

  • Other fixes in PR #2131 and #2064 make it easier to design and use Examples

3. Component Fixes 🧱

  • Specify the width and height of an image in its style tag (thanks to PR #2133)
components.Image().style(height=260, width=300)
  • Automatic conversion of videos so they are playable in the browser (thanks to PR #2003). Gradio will check if a video's format is playable in the browser and, if it isn't, will automatically convert it to a format that is (mp4).
  • Pass in a json filepath to the Label component (thanks to PR #2083)
  • Randomize the default value of a Slider (thanks to PR #1935)

slider-random

  • Improvements to State in PR #2100

4. Ability to Randomize Input Sliders and Reload Data whenever the Page Loads

  • In some cases, you want to be able to show a different set of input data to every user as they load the page app. For example, you might want to randomize the value of a "seed" Slider input. Or you might want to show a Textbox with the current date. We now supporting passing functions as the default value in input components. When you pass in a function, it gets re-evaluated every time someone loads the demo, allowing you to reload / change data for different users.

Here's an example loading the current date time into an input Textbox:

import gradio as gr
import datetime

with gr.Blocks() as demo:
    gr.Textbox(datetime.datetime.now)
    
demo.launch()

Note that we don't evaluate the function -- datetime.datetime.now() -- we pass in the function itself to get this behavior -- datetime.datetime.now

Because randomizing the initial value of Slider is a common use case, we've added a randomize keyword argument you can use to randomize its initial value:

import gradio as gr
demo = gr.Interface(lambda x:x, gr.Slider(0, 10, randomize=True), "number")
demo.launch()

5. New Guide 🖊️

Full change log below:

What's Changed

New Contributors

Full Changelog: v3.1.7...v3.2

Don't miss a new gradio release

NewReleases is sending notifications on new releases.