Update JsonInput docstring with client request example
@@ -38,17 +38,24 @@ class JsonInput(BaseInputAdapter):
```
@bentoml.api(input=LegacyJsonInput())
def predict(self, parsed_json):
- result = do_something_to_json(parsed_json)
- return result
+ results = self.artifacts.classifier([parsed_json['text']])
+ return results[0]
```
--->
```
@bentoml.api(input=JsonInput())
def predict(self, parsed_jsons):
- results = do_something_to_list_of_json(parsed_jsons)
+ results = self.artifacts.classifier([j['text'] for j in parsed_jsons])
return results
```
For clients, the request is the same as LegacyJsonInput, each includes single json.
+ ```
+ curl -i \
+ --header "Content-Type: application/json" \
+ --request POST \
+ --data '{"text": "best movie ever"}' \
+ localhost:5000/predict
+ ```
"""
BATCH_MODE_SUPPORTED = True
