We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Sample of image_transformer does not work
/kind bug
Sample under docs/samples/transformer/image_transformer is broken, there's python error in it.

**What steps did you take and what happened:**
[A clear and concise description of what the bug is.]
It's due to PR #492, kfmodel and kfserver is refactored now but the sample still inherit from transformer which does not exist now. Also some other symbols need be renamed.

**What did you expect to happen:**
Sample still works


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/samples/transformer/image_transformer/image_transformer/__main__.py`
Content:
```
1 # Copyright 2019 kubeflow.org.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import kfserving
16 import argparse
17 from .image_transformer import ImageTransformer
18 
19 DEFAULT_MODEL_NAME = "model"
20 
21 parser = argparse.ArgumentParser(parents=[kfserving.server.parser])
22 parser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,
23                     help='The name that the model is served under.')
24 parser.add_argument('--predictor_host', help='The URL for the model predict function', required=True)
25 
26 args, _ = parser.parse_known_args()
27 
28 if __name__ == "__main__":
29     transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host,
30                                    protocol=args.protocol)
31     kfserver = kfserving.KFServer()
32     kfserver.start(models=[transformer])
33
```

Path: `docs/samples/transformer/image_transformer/image_transformer/image_transformer.py`
Content:
```
1 # Copyright 2019 kubeflow.org.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 
15 import kfserving
16 from typing import List, Dict
17 from kfserving.transformer import Transformer
18 from PIL import Image
19 import torchvision.transforms as transforms
20 import logging
21 import io
22 import numpy as np
23 import base64
24 
25 logging.basicConfig(level=kfserving.constants.KFSERVING_LOGLEVEL)
26 
27 transform = transforms.Compose(
28         [transforms.ToTensor(),
29          transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
30 
31 
32 def image_transform(instance):
33     byte_array = base64.b64decode(instance['image_bytes']['b64'])
34     image = Image.open(io.BytesIO(byte_array))
35     a = np.asarray(image)
36     im = Image.fromarray(a)
37     res = transform(im)
38     logging.info(res)
39     return res.tolist()
40 
41 
42 class ImageTransformer(Transformer):
43 
44     def preprocess(self, inputs: Dict) -> Dict:
45         return {'instances': [image_transform(instance) for instance in inputs['instances']]}
46 
47     def postprocess(self, inputs: List) -> List:
48         return inputs
49
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/samples/transformer/image_transformer/image_transformer/__main__.py b/docs/samples/transformer/image_transformer/image_transformer/__main__.py
--- a/docs/samples/transformer/image_transformer/image_transformer/__main__.py
+++ b/docs/samples/transformer/image_transformer/image_transformer/__main__.py
@@ -18,7 +18,7 @@
 
 DEFAULT_MODEL_NAME = "model"
 
-parser = argparse.ArgumentParser(parents=[kfserving.server.parser])
+parser = argparse.ArgumentParser(parents=[kfserving.kfserver.parser])
 parser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,
                     help='The name that the model is served under.')
 parser.add_argument('--predictor_host', help='The URL for the model predict function', required=True)
@@ -26,7 +26,6 @@
 args, _ = parser.parse_known_args()
 
 if __name__ == "__main__":
-    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host,
-                                   protocol=args.protocol)
+    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host)
     kfserver = kfserving.KFServer()
     kfserver.start(models=[transformer])
diff --git a/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py b/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py
--- a/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py
+++ b/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py
@@ -14,7 +14,6 @@
 
 import kfserving
 from typing import List, Dict
-from kfserving.transformer import Transformer
 from PIL import Image
 import torchvision.transforms as transforms
 import logging
@@ -39,7 +38,10 @@
     return res.tolist()
 
 
-class ImageTransformer(Transformer):
+class ImageTransformer(kfserving.KFModel):
+    def __init__(self, name: str, predictor_host: str):
+        super().__init__(name)
+        self.predictor_host = predictor_host
 
     def preprocess(self, inputs: Dict) -> Dict:
         return {'instances': [image_transform(instance) for instance in inputs['instances']]}

{"golden_diff": "diff --git a/docs/samples/transformer/image_transformer/image_transformer/__main__.py b/docs/samples/transformer/image_transformer/image_transformer/__main__.py\n--- a/docs/samples/transformer/image_transformer/image_transformer/__main__.py\n+++ b/docs/samples/transformer/image_transformer/image_transformer/__main__.py\n@@ -18,7 +18,7 @@\n \n DEFAULT_MODEL_NAME = \"model\"\n \n-parser = argparse.ArgumentParser(parents=[kfserving.server.parser])\n+parser = argparse.ArgumentParser(parents=[kfserving.kfserver.parser])\n parser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,\n                     help='The name that the model is served under.')\n parser.add_argument('--predictor_host', help='The URL for the model predict function', required=True)\n@@ -26,7 +26,6 @@\n args, _ = parser.parse_known_args()\n \n if __name__ == \"__main__\":\n-    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host,\n-                                   protocol=args.protocol)\n+    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host)\n     kfserver = kfserving.KFServer()\n     kfserver.start(models=[transformer])\ndiff --git a/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py b/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py\n--- a/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py\n+++ b/docs/samples/transformer/image_transformer/image_transformer/image_transformer.py\n@@ -14,7 +14,6 @@\n \n import kfserving\n from typing import List, Dict\n-from kfserving.transformer import Transformer\n from PIL import Image\n import torchvision.transforms as transforms\n import logging\n@@ -39,7 +38,10 @@\n     return res.tolist()\n \n \n-class ImageTransformer(Transformer):\n+class ImageTransformer(kfserving.KFModel):\n+    def __init__(self, name: str, predictor_host: str):\n+        super().__init__(name)\n+        self.predictor_host = predictor_host\n \n     def preprocess(self, inputs: Dict) -> Dict:\n         return {'instances': [image_transform(instance) for instance in inputs['instances']]}\n", "issue": "Sample of image_transformer does not work\n/kind bug\r\nSample under docs/samples/transformer/image_transformer is broken, there's python error in it.\r\n\r\n**What steps did you take and what happened:**\r\n[A clear and concise description of what the bug is.]\r\nIt's due to PR #492, kfmodel and kfserver is refactored now but the sample still inherit from transformer which does not exist now. Also some other symbols need be renamed.\r\n\r\n**What did you expect to happen:**\r\nSample still works\r\n\n", "before_files": [{"content": "# Copyright 2019 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport kfserving\nimport argparse\nfrom .image_transformer import ImageTransformer\n\nDEFAULT_MODEL_NAME = \"model\"\n\nparser = argparse.ArgumentParser(parents=[kfserving.server.parser])\nparser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,\n                    help='The name that the model is served under.')\nparser.add_argument('--predictor_host', help='The URL for the model predict function', required=True)\n\nargs, _ = parser.parse_known_args()\n\nif __name__ == \"__main__\":\n    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host,\n                                   protocol=args.protocol)\n    kfserver = kfserving.KFServer()\n    kfserver.start(models=[transformer])\n", "path": "docs/samples/transformer/image_transformer/image_transformer/__main__.py"}, {"content": "# Copyright 2019 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport kfserving\nfrom typing import List, Dict\nfrom kfserving.transformer import Transformer\nfrom PIL import Image\nimport torchvision.transforms as transforms\nimport logging\nimport io\nimport numpy as np\nimport base64\n\nlogging.basicConfig(level=kfserving.constants.KFSERVING_LOGLEVEL)\n\ntransform = transforms.Compose(\n        [transforms.ToTensor(),\n         transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])\n\n\ndef image_transform(instance):\n    byte_array = base64.b64decode(instance['image_bytes']['b64'])\n    image = Image.open(io.BytesIO(byte_array))\n    a = np.asarray(image)\n    im = Image.fromarray(a)\n    res = transform(im)\n    logging.info(res)\n    return res.tolist()\n\n\nclass ImageTransformer(Transformer):\n\n    def preprocess(self, inputs: Dict) -> Dict:\n        return {'instances': [image_transform(instance) for instance in inputs['instances']]}\n\n    def postprocess(self, inputs: List) -> List:\n        return inputs\n", "path": "docs/samples/transformer/image_transformer/image_transformer/image_transformer.py"}], "after_files": [{"content": "# Copyright 2019 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport kfserving\nimport argparse\nfrom .image_transformer import ImageTransformer\n\nDEFAULT_MODEL_NAME = \"model\"\n\nparser = argparse.ArgumentParser(parents=[kfserving.kfserver.parser])\nparser.add_argument('--model_name', default=DEFAULT_MODEL_NAME,\n                    help='The name that the model is served under.')\nparser.add_argument('--predictor_host', help='The URL for the model predict function', required=True)\n\nargs, _ = parser.parse_known_args()\n\nif __name__ == \"__main__\":\n    transformer = ImageTransformer(args.model_name, predictor_host=args.predictor_host)\n    kfserver = kfserving.KFServer()\n    kfserver.start(models=[transformer])\n", "path": "docs/samples/transformer/image_transformer/image_transformer/__main__.py"}, {"content": "# Copyright 2019 kubeflow.org.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport kfserving\nfrom typing import List, Dict\nfrom PIL import Image\nimport torchvision.transforms as transforms\nimport logging\nimport io\nimport numpy as np\nimport base64\n\nlogging.basicConfig(level=kfserving.constants.KFSERVING_LOGLEVEL)\n\ntransform = transforms.Compose(\n        [transforms.ToTensor(),\n         transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])\n\n\ndef image_transform(instance):\n    byte_array = base64.b64decode(instance['image_bytes']['b64'])\n    image = Image.open(io.BytesIO(byte_array))\n    a = np.asarray(image)\n    im = Image.fromarray(a)\n    res = transform(im)\n    logging.info(res)\n    return res.tolist()\n\n\nclass ImageTransformer(kfserving.KFModel):\n    def __init__(self, name: str, predictor_host: str):\n        super().__init__(name)\n        self.predictor_host = predictor_host\n\n    def preprocess(self, inputs: Dict) -> Dict:\n        return {'instances': [image_transform(instance) for instance in inputs['instances']]}\n\n    def postprocess(self, inputs: List) -> List:\n        return inputs\n", "path": "docs/samples/transformer/image_transformer/image_transformer/image_transformer.py"}]}