Here's what's new in 2.7.5
:
1. Backend Migration to Starlette and FastAPI 🛠️
We have migrated gradio
's backend from flask
to starlette
and fastapi
. We did this to take advantage of speed and running things asynchronously. Migration work was done in #440
This should not affect user workflow at all—just make it faster!
Load testing before and after migration:
2. (BETA) Custom Flagging Callbacks and HuggingFaceDatasetSaver 🏁
We’ve expanded functionality on our Flagging feature. You can now write custom code that gets run when the FLAG button is clicked. One cool thing that this allows you to do is to easily build a crowd-sourced :hugging_face: Hugging Face dataset from people trying out your model and flagging samples of interest. This was primarily built in #362
For example, here's the code to build a demo for a simple text-to-text interface that saves all the inputs and outputs to a Hugging Face dataset:
import gradio as gr
HF_TOKEN = <YOUR_HF_TOKEN>
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "hello-world", private=False)
iface = gr.Interface(lambda x:"hello " + x + "!", "text", "text", flagging_callback=hf_writer)
iface.launch(share=True)
Running the code above will produce:
flagging-with-datasets.mov
Note: You may start using this immediately but the team is still working on making it better. Feel free to reach out to us with feedback here or on a discussions post.
3. Small Fixes 🔧
What's Changed
- Format The Codebase by @FarukOzderim in #478
- Custom Flagging Callbacks & Flagging for Hugging Face Spaces by @abidlabs in #362
- Introduce Example Type Hints by @FarukOzderim in #437
- Fixed Autoflagging by @abidlabs in #441
- Migration of backend from Flask to FastAPI/Starlette by @abidlabs in #440
- Bump follow-redirects from 1.13.3 to 1.14.7 in /frontend by @dependabot in #459
- Have Spaces Flagging Automatically Preview Audio and Images by @abidlabs in #468
- Better documentation on the website by @abidlabs in #464
- Fixed concurrency issue by @abidlabs in #472
- fixed queueing bug by @abidlabs in #474
- fixed favicon by @abidlabs in #475
New Contributors
- @FarukOzderim made their first contribution in #437
Full Changelog: v2.7.1...v2.7.5