# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: 'Serve PyTorch Model - Seldon Core'
description: |
  Serve PyTorch Models remotely as web service using Seldon Core
metadata:
  annotations: {platform: 'OpenSource'}
inputs:
  - {name: model_id,            description: 'Required. Model training_id from Fabric for Deep Learning'}
  - {name: deployment_name,     description: 'Required. Deployment name for the seldon service'}
  - {name: model_class_name,    description: 'PyTorch model class name', default: 'ModelClass'}
  - {name: model_class_file,    description: 'File that contains the PyTorch model class', default: 'model_class.py'}
  - {name: serving_image,       description: 'Model serving images', default: 'aipipeline/seldon-pytorch:0.1'}
outputs:
  - {name: output,              description: 'Model Serving status'}
implementation:
  container:
    image: docker.io/aipipeline/ffdl-serve:latest
    command: ['python']
    args: [
      -u, serve.py,
      --model_id, {inputValue: model_id},
      --deployment_name, {inputValue: deployment_name},
      --model_class_name, {inputValue: model_class_name},
      --model_class_file, {inputValue: model_class_file},
      --serving_image, {inputValue: serving_image},
      --output_deployment_result_path, {outputPath: output}
    ]
