mirror of
https://github.com/clearlinux/dockerfiles.git
synced 2026-09-06 13:41:32 +00:00
@@ -1,94 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: server
|
||||
data:
|
||||
app.py: |
|
||||
#!/usr/bin/python3
|
||||
|
||||
import subprocess
|
||||
from flask import Flask, request
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def classification_sample():
|
||||
return 'Classification sample'
|
||||
|
||||
@app.route('/image', methods=['POST'])
|
||||
def do_classification():
|
||||
if request.headers['Content-Type'] == 'application/octet-stream':
|
||||
f = open('./image', 'wb')
|
||||
f.write(request.data)
|
||||
return subprocess.check_output("classification_sample -i ./image -m /model/alexnet.xml", shell=True)
|
||||
else:
|
||||
return "415 Unsupported Media Type ;)"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host='0.0.0.0')
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: openvino-deploy
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: classification
|
||||
spec:
|
||||
initContainers:
|
||||
- name: model-init
|
||||
image: sevenzheng/clr-openvino
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: http_proxy
|
||||
#value: $http_proxy
|
||||
value: http://child-prc.intel.com:913
|
||||
- name: https_proxy
|
||||
#value: $https_proxy
|
||||
value: http://child-prc.intel.com:913
|
||||
command:
|
||||
- "bash"
|
||||
- "-c"
|
||||
- "cd /model && downloader.py --name alexnet && mo.py --input_model ./classification/alexnet/caffe/alexnet.caffemodel"
|
||||
volumeMounts:
|
||||
- mountPath: /model
|
||||
name: model
|
||||
containers:
|
||||
- name: classification
|
||||
image: sevenzheng/clr-openvino
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- "python3"
|
||||
- "app.py"
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
volumeMounts:
|
||||
- mountPath: /model
|
||||
name: model
|
||||
- name: server-py
|
||||
mountPath: /work/app.py
|
||||
subPath: app.py
|
||||
volumes:
|
||||
- name: model
|
||||
emptyDir: {}
|
||||
- name: server-py
|
||||
configMap:
|
||||
name: server
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: openvino-server
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 5000
|
||||
nodePort: 30008
|
||||
selector:
|
||||
app: classification
|
||||
Reference in New Issue
Block a user