Gradio#

To deploy a Gradio application in Ploomber Cloud you need:

Dockerfile#

You need to provide a Dockerfile, you can use this template to get started. The template contains the minimal steps needed for a deployment but you need to modify so it installs any required dependencies and copies your code into the Docker image.

FROM python:3.11

COPY app.py app.py
RUN pip install gradio

ENV GRADIO_SERVER_PORT=80
ENV GRADIO_SERVER_NAME=0.0.0.0

ENTRYPOINT ["gradio", "app.py"]

Testing locally#

To test your app, you can use docker locally:

# build the docker image
docker build . -t gradio

# run it
docker run -p 5000:80 gradio

Now, open http://0.0.0.0:5000/ to see your app.

Deploy#

Once you have all your files, create a zip file.

To deploy a Gradio app from the deployment menu, follow these instructions:

Tip

To ensure your app doesn’t break on re-deployments, pin your dependencies.