|
| 1 | +# Deploy VisualQnA in a Kubernetes Cluster |
| 2 | + |
| 3 | +This document outlines the deployment process for a Visual Question Answering (VisualQnA) application that utilizes the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice components on Intel Xeon servers and Gaudi machines. |
| 4 | + |
| 5 | +Please install GMC in your Kubernetes cluster, if you have not already done so, by following the steps in Section "Getting Started" at [GMC Install](https://github.com/opea-project/GenAIInfra/tree/main/microservices-connector#readme). We will soon publish images to Docker Hub, at which point no builds will be required, further simplifying install. |
| 6 | + |
| 7 | +If you have only Intel Xeon machines you could use the visualqna_xeon.yaml file or if you have a Gaudi cluster you could use visualqna_gaudi.yaml |
| 8 | +In the below example we illustrate on Xeon. |
| 9 | + |
| 10 | +## Deploy the VisualQnA application |
| 11 | + |
| 12 | +1. Create the desired namespace if it does not already exist and deploy the application |
| 13 | + ```bash |
| 14 | + export APP_NAMESPACE=CT |
| 15 | + kubectl create ns $APP_NAMESPACE |
| 16 | + sed -i "s|namespace: visualqna|namespace: $APP_NAMESPACE|g" ./visualqna_xeon.yaml |
| 17 | + kubectl apply -f ./visualqna_xeon.yaml |
| 18 | + ``` |
| 19 | + |
| 20 | +2. Check if the application is up and ready |
| 21 | + ```bash |
| 22 | + kubectl get pods -n $APP_NAMESPACE |
| 23 | + ``` |
| 24 | + |
| 25 | +3. Deploy a client pod for testing |
| 26 | + ```bash |
| 27 | + kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity |
| 28 | + ``` |
| 29 | + |
| 30 | +4. Check that client pod is ready |
| 31 | + ```bash |
| 32 | + kubectl get pods -n $APP_NAMESPACE |
| 33 | + ``` |
| 34 | + |
| 35 | +5. Send request to application |
| 36 | + ```bash |
| 37 | + export CLIENT_POD=$(kubectl get pod -n $APP_NAMESPACE -l app=client-test -o jsonpath={.items..metadata.name}) |
| 38 | + export accessUrl=$(kubectl get gmc -n $APP_NAMESPACE -o jsonpath="{.items[?(@.metadata.name=='visualqna')].status.accessUrl}") |
| 39 | + kubectl exec "$CLIENT_POD" -n $APP_NAMESPACE -- curl $accessUrl -X POST -d '{"messages": [ |
| 40 | + { |
| 41 | + "role": "user", |
| 42 | + "content": [ |
| 43 | + { |
| 44 | + "type": "text", |
| 45 | + "text": "What'\''s in this image?" |
| 46 | + }, |
| 47 | + { |
| 48 | + "type": "image_url", |
| 49 | + "image_url": { |
| 50 | + "url": "https://www.ilankelman.org/stopsigns/australia.jpg" |
| 51 | + } |
| 52 | + } |
| 53 | + ] |
| 54 | + } |
| 55 | + ], |
| 56 | + "max_tokens": 128}' -H 'Content-Type: application/json' > $LOG_PATH/gmc_visualqna.log |
| 57 | + ``` |
0 commit comments