Spaces:
Running
gradio_client
0.16.4
Fixes
0.16.3
Features
Fixes
- #8276
0bf3d1a
- Fix bug where client could not connect to apps that had self signed certificates. Thanks @freddyaboulton!
0.16.2
Fixes
0.16.1
Highlights
Support custom components in gr.load (#8200 72039be
)
It is now possible to load a demo with a custom component with gr.load
.
The custom component must be installed in your system and imported in your python session.
import gradio as gr
import gradio_pdf
demo = gr.load("freddyaboulton/gradiopdf", src="spaces")
if __name__ == "__main__":
demo.launch()
Thanks @freddyaboulton!
Fixes
0.16.0
Highlights
Setting File Upload Limits (#7909 2afca65
)
We have added a max_file_size
size parameter to launch()
that limits to size of files uploaded to the server. This limit applies to each individual file. This parameter can be specified as a string or an integer (corresponding to the size in bytes).
The following code snippet sets a max file size of 5 megabytes.
import gradio as gr
demo = gr.Interface(lambda x: x, "image", "image")
demo.launch(max_file_size="5mb")
# or
demo.launch(max_file_size=5 * gr.FileSize.MB)
Error states can now be cleared
When a component encounters an error, the error state shown in the UI can now be cleared by clicking on the x
icon in the top right of the component. This applies to all types of errors, whether it's raised in the UI or the server.
Thanks @freddyaboulton!
Features
0.15.1
Features
- #7850
2bae1cf
- Adds an "API Recorder" to the view API page, some internal methods have been made async. Thanks @abidlabs!
0.15.0
Highlights
Automatically delete state after user has disconnected from the webpage (#7829 6a4bf7a
)
Gradio now automatically deletes gr.State
variables stored in the server's RAM when users close their browser tab.
The deletion will happen 60 minutes after the server detected a disconnect from the user's browser.
If the user connects again in that timeframe, their state will not be deleted.
Additionally, Gradio now includes a Blocks.unload()
event, allowing you to run arbitrary cleanup functions when users disconnect (this does not have a 60 minute delay).
You can think of the unload
event as the opposite of the load
event.
with gr.Blocks() as demo:
gr.Markdown(
"""# State Cleanup Demo
🖼️ Images are saved in a user-specific directory and deleted when the users closes the page via demo.unload.
""")
with gr.Row():
with gr.Column(scale=1):
with gr.Row():
img = gr.Image(label="Generated Image", height=300, width=300)
with gr.Row():
gen = gr.Button(value="Generate")
with gr.Row():
history = gr.Gallery(label="Previous Generations", height=500, columns=10)
state = gr.State(value=[], delete_callback=lambda v: print("STATE DELETED"))
demo.load(generate_random_img, [state], [img, state, history])
gen.click(generate_random_img, [state], [img, state, history])
demo.unload(delete_directory)
demo.launch(auth=lambda user,pwd: True,
auth_message="Enter any username and password to continue")
Thanks @freddyaboulton!
Fixes
0.14.0
Features
- #7800
b0a3ea9
- Small fix to client.view_api() in the case of default file values. Thanks @abidlabs! - #7732
2efb05e
- Adds support for kwargs and default arguments in the python client, and improves how parameter information is displayed in the "view API" page. Thanks @abidlabs!
0.13.0
Features
Fixes
- #7718
6390d0b
- Add support for python client connecting to gradio apps running with self-signed SSL certificates. Thanks @abidlabs! - #7706
bc61ff6
- Several fixes togr.load
. Thanks @abidlabs!
0.12.0
Fixes
- #7575
d0688b3
- Files should now be supplied asfile(...)
in the Client, and some fixes togr.load()
as well. Thanks @abidlabs! - #7618
0ae1e44
- Control which files get moved to cache with gr.set_static_paths. Thanks @freddyaboulton!
0.11.0
Features
- #7407
375bfd2
- Fix server_messages.py to use the patched BaseModel class for Wasm env. Thanks @aliabid94!
Fixes
- #7555
fc4c2db
- Allow Python Client to upload/download files when connecting to Gradio apps with auth enabled. Thanks @abidlabs!
0.10.1
Features
- #7495
ddd4d3e
- Enable Ruff S101. Thanks @abidlabs! - #7443
b7a97f2
- Updatehttpx
tohttpx>=0.24.1
inrequirements.txt
. Thanks @abidlabs!
0.10.0
Features
- #7183
49d9c48
- [WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component. Thanks @abidlabs! - #7377
6dfd40f
- Make set_documentation_group a no-op. Thanks @freddyaboulton! - #7334
b95d0d0
- Allow setting custom headers in Python Client. Thanks @abidlabs!
Fixes
0.9.0
Features
- #7062
0fddd0f
- Determine documentation group automatically. Thanks @akx! - #7102
68a54a7
- Improve chatbot streaming performance with diffs. Thanks @aliabid94!/n Note that this PR changes the API format for generator functions, which would be a breaking change for any clients reading the EventStream directly - #7116
3c8c4ac
- Document thegr.ParamViewer
component, and fix component preprocessing/postprocessing docstrings. Thanks @abidlabs! - #7061
05d8a3c
- Update ruff to 0.1.13, enable more rules, fix issues. Thanks @akx!
Fixes
- #7178
9f23b0b
- Optimize client view_api method. Thanks @freddyaboulton! - #7322
b25e95e
- Fixprocessing_utils.save_url_to_cache()
to follow redirects when accessing the URL. Thanks @whitphx!
0.8.1
Features
- #7075
1fc8a94
- fix lint. Thanks @freddyaboulton! - #7054
64c65d8
- Add encoding to open/writing files on the deploy_discord function. Thanks @WilliamHarer!
0.8.0
Fixes
- #6846
48d6534
- Addshow_api
parameter to events, and fixgr.load()
. Also makes some minor improvements to the "view API" page when running on Spaces. Thanks @abidlabs! - #6767
7bb561a
- Rewriting parts of the README and getting started guides for 4.0. Thanks @abidlabs!
0.7.3
Fixes
- #6693
34f9431
- Python client properly handles hearbeat and log messages. Also handles responses longer than 65k. Thanks @freddyaboulton!
0.7.2
Features
- #6598
7cbf96e
- Issue 5245: consolidate usage of requests and httpx. Thanks @cswamy! - #6704
24e0481
- Hotfix: updatehuggingface_hub
dependency version. Thanks @abidlabs! - #6543
8a70e83
- switch from black to ruff formatter. Thanks @DarhkVoyd!
Fixes
- #6556
d76bcaa
- Fix api event drops. Thanks @aliabid94!
0.7.1
Fixes
0.7.0
Features
- #5498
287fe6782
- Add json schema unit tests. Thanks @pngwn! - #5498
287fe6782
- Image v4. Thanks @pngwn! - #5498
287fe6782
- Custom components. Thanks @pngwn! - #5498
287fe6782
- Swap websockets for SSE. Thanks @pngwn!
0.7.0-beta.2
Features
- #6094
c476bd5a5
- Image v4. Thanks @pngwn! - #6069
bf127e124
- Swap websockets for SSE. Thanks @aliabid94!
0.7.0-beta.1
Features
- #6082
037e5af33
- WIP: Fix docs. Thanks @freddyaboulton! - #5970
0c571c044
- Add json schema unit tests. Thanks @freddyaboulton! - #6073
abff6fb75
- Fix remaining xfail tests in backend. Thanks @freddyaboulton!
0.7.0-beta.0
Features
- #5498
85ba6de13
- Simplify how files are handled in components in 4.0. Thanks @pngwn! - #5498
85ba6de13
- Rename gradio_component to gradio component. Thanks @pngwn!
0.6.1
Fixes
- #5811
1d5b15a2d
- Assert refactor in external.py. Thanks @harry-urek!
0.6.0
Highlights
new FileExplorer
component (#5672 e4a307ed6
)
Thanks to a new capability that allows components to communicate directly with the server without passing data via the value, we have created a new FileExplorer
component.
This component allows you to populate the explorer by passing a glob, but only provides the selected file(s) in your prediction function.
Users can then navigate the virtual filesystem and select files which will be accessible in your predict function. This component will allow developers to build more complex spaces, with more flexible input options.
For more information check the FileExplorer
documentation.
Thanks @aliabid94!
0.5.3
Features
- #5721
84e03fe50
- Adds copy buttons to website, and better descriptions to API Docs. Thanks @aliabd!
0.5.2
Features
- #5653
ea0e00b20
- Prevent Clients from accessing API endpoints that setapi_name=False
. Thanks @abidlabs!
0.5.1
Features
- #5514
52f783175
- refactor: Use package.json for version management. Thanks @DarhkVoyd!
0.5.0
Highlights
Enable streaming audio in python client (#5248 390624d8
)
The gradio_client
now supports streaming file outputs 🌊
No new syntax! Connect to a gradio demo that supports streaming file outputs and call predict
or submit
as you normally would.
import gradio_client as grc
client = grc.Client("gradio/stream_audio_out")
# Get the entire generated audio as a local file
client.predict("/Users/freddy/Pictures/bark_demo.mp4", api_name="/predict")
job = client.submit("/Users/freddy/Pictures/bark_demo.mp4", api_name="/predict")
# Get the entire generated audio as a local file
job.result()
# Each individual chunk
job.outputs()
Thanks @freddyaboulton!
Fixes
- #5295
7b8fa8aa
- Allow caching examples with streamed output. Thanks @aliabid94!
0.4.0
Highlights
Client.predict will now return the final output for streaming endpoints (#5057 35856f8b
)
This is a breaking change (for gradio_client only)!
Previously, Client.predict
would only return the first output of an endpoint that streamed results. This was causing confusion for developers that wanted to call these streaming demos via the client.
We realize that developers using the client don't know the internals of whether a demo streams or not, so we're changing the behavior of predict to match developer expectations.
Using Client.predict
will now return the final output of a streaming endpoint. This will make it even easier to use gradio apps via the client.
Thanks @freddyaboulton!
Features
- #5076
2745075a
- Add deploy_discord to docs. Thanks @freddyaboulton!
Fixes
- #5061
136adc9c
- Ensuregradio_client
is backwards compatible withgradio==3.24.1
. Thanks @abidlabs!
0.3.0
Highlights
Create Discord Bots from Gradio Apps 🤖 (#4960 46e4ef67
)
We're excited to announce that Gradio can now automatically create a discord bot from any gr.ChatInterface
app.
It's as easy as importing gradio_client
, connecting to the app, and calling deploy_discord
!
🦙 Turning Llama 2 70b into a discord bot 🦙
import gradio_client as grc
grc.Client("ysharma/Explore_llamav2_with_TGI").deploy_discord(to_id="llama2-70b-discord-bot")
Getting started with template spaces
To help get you started, we have created an organization on Hugging Face called gradio-discord-bots with template spaces you can use to turn state of the art LLMs powered by Gradio to discord bots.
Currently we have template spaces for:
- Llama-2-70b-chat-hf powered by a FREE Hugging Face Inference Endpoint!
- Llama-2-13b-chat-hf powered by Hugging Face Inference Endpoints.
- Llama-2-13b-chat-hf powered by Hugging Face transformers.
- falcon-7b-instruct powered by Hugging Face Inference Endpoints.
- gpt-3.5-turbo, powered by openai. Requires an OpenAI key.
But once again, you can deploy ANY gr.ChatInterface
app exposed on the internet! So don't hesitate to try it on your own Chatbots.
❗️ Additional Note ❗️: Technically, any gradio app that exposes an api route that takes in a single string and outputs a single string can be deployed to discord. But gr.ChatInterface
apps naturally lend themselves to discord's chat functionality so we suggest you start with those.
Thanks @freddyaboulton!
New Features:
- Endpoints that return layout components are now properly handled in the
submit
andview_api
methods. Output layout components are not returned by the API but all other components are (excludinggr.State
). By @freddyaboulton in PR 4871
Bug Fixes:
No changes to highlight
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
0.2.9
New Features:
No changes to highlight
Bug Fixes:
- Fix bug determining the api name when a demo has
api_name=False
by @freddyboulton in PR 4886
Breaking Changes:
No changes to highlight.
Full Changelog:
- Pinned dependencies to major versions to reduce the likelihood of a broken
gradio_client
due to changes in downstream dependencies by @abidlabs in PR 4885
0.2.8
New Features:
Bug Fixes:
- Fix bug where space duplication would error if the demo has cpu-basic hardware by @freddyaboulton in PR 4583
- Fixes and optimizations to URL/download functions by @akx in PR 4695
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
0.2.7
New Features:
- The output directory for files downloaded via the Client can now be set by the
output_dir
parameter inClient
by @abidlabs in PR 4501
Bug Fixes:
- The output directory for files downloaded via the Client are now set to a temporary directory by default (instead of the working directory in some cases) by @abidlabs in PR 4501
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
0.2.6
New Features:
No changes to highlight.
Bug Fixes:
- Fixed bug file deserialization didn't preserve all file extensions by @freddyaboulton in PR 4440
- Fixed bug where mounted apps could not be called via the client by @freddyaboulton in PR 4435
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
0.2.5
New Features:
No changes to highlight.
Bug Fixes:
- Fixes parameter names not showing underscores by @abidlabs in PR 4230
- Fixes issue in which state was not handled correctly if
serialize=False
by @abidlabs in PR 4230
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
0.2.4
Bug Fixes:
- Fixes missing serialization classes for several components:
Barplot
,Lineplot
,Scatterplot
,AnnotatedImage
,Interpretation
by @abidlabs in PR 4167
Documentation Changes:
No changes to highlight.
Testing and Infrastructure Changes:
No changes to highlight.
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
Contributors Shoutout:
No changes to highlight.
0.2.3
New Features:
No changes to highlight.
Bug Fixes:
- Fix example inputs for
gr.File(file_count='multiple')
output components by @freddyaboulton in PR 4153
Documentation Changes:
No changes to highlight.
Testing and Infrastructure Changes:
No changes to highlight.
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
Contributors Shoutout:
No changes to highlight.
0.2.2
New Features:
No changes to highlight.
Bug Fixes:
- Only send request to
/info
route if demo version is above3.28.3
by @freddyaboulton in PR 4109
Other Changes:
- Fix bug in test from gradio 3.29.0 refactor by @freddyaboulton in PR 4138
Breaking Changes:
No changes to highlight.
0.2.1
New Features:
No changes to highlight.
Bug Fixes:
Removes extraneous State
component info from the Client.view_api()
method by @abidlabs in PR 4107
Documentation Changes:
No changes to highlight.
Testing and Infrastructure Changes:
Separates flaky tests from non-flaky tests by @abidlabs in PR 4107
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
Contributors Shoutout:
No changes to highlight.
0.1.4
New Features:
- Progress Updates from
gr.Progress()
can be accessed viajob.status().progress_data
by @freddyaboulton](https://github.com/freddyaboulton) in PR 3924
Bug Fixes:
- Fixed bug where unnamed routes where displayed with
api_name
instead offn_index
inview_api
by @freddyaboulton in PR 3972
Documentation Changes:
No changes to highlight.
Testing and Infrastructure Changes:
No changes to highlight.
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
Contributors Shoutout:
No changes to highlight.
0.1.3
New Features:
No changes to highlight.
Bug Fixes:
- Fixed bug where
Video
components in latest gradio were not able to be deserialized by @freddyaboulton in PR 3860
Documentation Changes:
No changes to highlight.
Testing and Infrastructure Changes:
No changes to highlight.
Breaking Changes:
No changes to highlight.
Full Changelog:
No changes to highlight.
Contributors Shoutout:
No changes to highlight.
0.1.2
First public release of the Gradio Client library! The gradio_client
Python library that makes it very easy to use any Gradio app as an API.
As an example, consider this Hugging Face Space that transcribes audio files that are recorded from the microphone.
Using the gradio_client
library, we can easily use the Gradio as an API to transcribe audio files programmatically.
Here's the entire code to do it:
from gradio_client import Client
client = Client("abidlabs/whisper")
client.predict("audio_sample.wav")
>> "This is a test of the whisper speech recognition model."
Read more about how to use the gradio_client
library here: https://gradio.app/getting-started-with-the-python-client/