Python library for easily interacting with trained machine learning models
Project description
gradio_client
: Use any Gradio app as an API -- in 3 lines of Python
This directory contains the source code for gradio_client
, a lightweight Python library that makes it very easy to use any Gradio app as an API. This library is
As an example, consider the Stable Diffusion Gradio app, which is hosted on Hugging Face Spaces, and which generates images given a text prompt. Using the gradio_client
library, we can easily use the Gradio as an API to generates images programmatically.
Here's the entire code to do it:
import gradio_client as grc
client = grc.Client(space="stability-ai/stable-diffusion")
job = client.predict("a hyperrealistic portrait of a cat wearing cyberpunk armor")
job.result()
>> URL
Installation
The lightweit gradio_client
package can be installed from pip:
$ pip install gradio_client
Usage
Connecting to a Space or a Gradio app
- Connecting to a Space
- Connecting a general Gradio app
Inspecting the API
- Listing all of the available APIs
- Getting more info about the parameters for a speciic API
Making a prediction
- client.run
Submitting a job (for asynchronous worklows)
- job = client.submit
- job.status
- callbacks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gradio_client-0.0.1.tar.gz
(7.6 kB
view hashes)
Built Distribution
Close
Hashes for gradio_client-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb75e1229f490ba900109c0776cb72f92320bdd5e3d0984e3d876c3acbfbef3 |
|
MD5 | df7ef3c6f090c0f9d73239c7899e04b7 |
|
BLAKE2b-256 | 8ff536465ed5d45451b0d3890bf0573d4dc78b6ce6dfcc02b685d47be6c8c278 |