Appearance
Are you an LLM? You can read better optimized documentation at /usecases/demos/deploy-demo.md for this page in Markdown format
Deploy a Demo
On this page you will learn how to deploy a Demo for your Use Case. You will learn how deployments work, the requirements for host and port configuration, and how to deploy a Demo step-by-step.
How deployments work
To deploy a Demo, simply connect a GitHub or GitLab repository. The platform deploys the branch you select, main by default, and automatically triggers a re-deployment every time you push to that branch. Each deployed Demo has a resource limit of 1 CPU and 512 MiB of memory and automatically scales to zero when not in use.
Host and port configuration
Your Demo application must listen for requests on 0.0.0.0 on the port 8080.
CORS configuration
Your webserver configuration must allow cross-origin requests (CORS) from Kipu Quantum Hub. This is necessary to allow users to view your Demo application direclty via the platform .
WARNING
Besides the configuration of the Access-Control-Allow-Origin and the Access-Control-Allow-Methods corresponding to your demo application, you must allow the following headers in your CORS policy:
AuthorizationContent-TypeX-OrganizationId
Gradio CORS configuration
An example CORS configuration for a Gradio app would look like this:
python
import gradio as gr
def your_function(input):
return "Hello, " + input
app = gr.Interface(fn=your_function, inputs="text", outputs="text")
# Launch with custom server settings and CORS headers
app.launch(
server_name="0.0.0.0",
server_port=8080,
allowed_origins=["*"],
allowed_headers=["Authorization", "Content-Type", "X-OrganizationId"]
)NGINX CORS configuration
An example configuration using NGINX as a webserver could look like this:
nginx
server {
listen 0.0.0.0:8080 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
# CORS Headers
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-OrganizationId' always;
# Handle preflight
if ($request_method = OPTIONS) {
return 204;
}
}
}A step-by-step guide to deploy a Demo
A simple way to create a Demo is to use the Gradio python library. Gradio lets you build interactive web interfaces in a matter of minutes. Check out the Gradio starter template from the PlanQK research project. Alternatively, you can deploy any other web app of your choice using Docker.
The following steps show you how to deploy a Demo for your Use Case.
Prerequisites:
A Use Case you want to deploy a Demo for. Alternatively, create a new Use Case.
A fork of the Gradio starter template from the PlanQK research project.
A Git integration with access to your fork. To connect one, open Settings, select Git Integrations, and click Connect integration.
To deploy a Demo for your Use Case, open the Demo tab of your Use Case. As long as the Use Case has no Demo, the tab shows a wizard with three steps:
- Repository: pick the Git integration and select the fork of the Gradio starter template you created earlier.
- Branch: enter the branch to build,
mainby default. - Environment: set the environment variables your Demo needs. In order to make the Gradio starter work, you need to set the credentials of a subscribed Application, see Set Environment Variables.
Click Build demo. While the platform builds your Demo, its status shows Building; once it is ready, the status changes to Available and the Demo appears in the tab. That's it, you deployed your first Demo!

