agora/shopper_insights_api/operations/shopper-insights.yaml (101 lines of code) (raw):
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: acsa-pvc
namespace: contoso-hypermarket
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: cloud-backed-sc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: shopper-model-pvc
namespace: contoso-hypermarket
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: shopper-insights-api
namespace: contoso-hypermarket
spec:
replicas: 1
selector:
matchLabels:
app: shopper-insights-api
template:
metadata:
labels:
app: shopper-insights-api
spec:
initContainers:
- name: init-download-model
image: mcr.microsoft.com/cbl-mariner/base/core:2.0
command:
- sh
- -c
- |
tdnf update -y
tdnf install wget -y
wget -O /tmp/models/person-detection-retail-0013.bin https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/person-detection-retail-0013.bin
wget -O /tmp/models/person-detection-retail-0013.xml https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/person-detection-retail-0013.xml
wget -O /tmp/models/person-reidentification-retail-0287.bin https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/person-reidentification-retail-0287.bin
wget -O /tmp/models/person-reidentification-retail-0287.xml https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/person-reidentification-retail-0287.xml
wget -O /tmp/models/age-gender-recognition-retail-0013.bin https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/age-gender-recognition-retail-0013.bin
wget -O /tmp/models/age-gender-recognition-retail-0013.xml https://download.microsoft.com/download/ad457769-60e2-4e4b-8756-8d9fada0b60a/age-gender-recognition-retail-0013.xml
volumeMounts:
- name: models-volume
mountPath: /tmp/models
containers:
- name: shopper-insights-api
image: mcr.microsoft.com/jumpstart/agora/shopper_insights_api:1.0.0
ports:
- containerPort: 5001
env:
- name: MODEL_PATH
value: "/tmp/models/"
- name: RTSP_URL
value: "rtsp://rtsp-stream-aisle:8554/stream"
- name: FLASK_PORT
value: "5001"
- name: ENABLE_SAVING
value: "True"
volumeMounts:
- mountPath: /tmp/models
name: models-volume
- mountPath: /usr/src/app/detected_persons
name: blob
volumes:
- name: models-volume
persistentVolumeClaim:
claimName: shopper-model-pvc
- name: blob
persistentVolumeClaim:
claimName: acsa-pvc
---
apiVersion: v1
kind: Service
metadata:
name: shopper-insights-api
namespace: contoso-hypermarket
labels:
app: shopper-insights-service
spec:
selector:
app: shopper-insights-api
ports:
- name: shopper-insights-metrics
protocol: TCP
port: 5001
targetPort: 5001
type: LoadBalancer