Gradio is an open-source Python package that allows you to quickly build a web application for your model, API, or any arbitrary Python function. This project demonstrates how to add a Gradio web UI to a BentoML Service.
See here for a full list of BentoML example projects.
git clone https://github.com/bentoml/BentoGradio.git
cd BentoGradio
# Recommend Python 3.11
pip install -r requirements.txt
We have defined a BentoML Service in service.py
. Run bentoml serve
in your project directory to start the Service.
$ bentoml serve .
You can access the Gradio web UI at http://localhost:3000/ui.
For detailed explanations, see the BentoML documentation.
After the Service is ready, you can deploy the application to BentoCloud for better management and scalability. Sign up if you haven't got a BentoCloud account.
Make sure you have logged in to BentoCloud.
bentoml cloud login
Deploy it from the project directory.
bentoml deploy .
Once the application is up and running, you can access it via the exposed URL.
Note: For custom deployment in your own infrastructure, use BentoML to generate an OCI-compliant image.