Launch Gradio Block with a custom url

I want to host multiple instances of a Gradio Block on different endpoints. For example, setting a block to be accessible via localhost:7890/gradio/id123. I know that I can control the server name and port with the environment variables with GRADIO_SERVER_NAME and GRADIO_SERVER_PORT, but neither is useful if I want to create multiple gradio Blocks exposed on different endpoints. How would I go about doing this?

Hi @at123 thanks for asking this question! You should create multiple Gradio Blocks and then mount them within a larger FastAPI application. This is described here: Sharing Your App

1 Like