tobegit3hub / simple_tensorflow_serving

Generic and easy-to-use serving service for machine learning models
https://stfs.readthedocs.io
Apache License 2.0
757 stars 193 forks source link

KeyError: 'default' #24

Closed Johnson-yue closed 6 years ago

Johnson-yue commented 6 years ago

Hi, it is me again. I think I have a lot of problems. [1] : When I run simple_tensorflow_serving --model_config_file="./examples/model_config_file.json" . and then run curl http://localhost:8500/v1/models/default/gen_json the output is : Client : { <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

500 Internal Server Error Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

} Server log: {

[2] : Multiple Models Started... , and I run client.py. my client.py is: `#!/usr/bin/env python

import requests

def main(): endpoint = "http://127.0.0.1:8500" input_data = { "model_name": "tensorflow_template_application_model", "model_version": 2, "data": { "keys": [[11.0], [2.0]], "features": [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]] } } result = requests.post(endpoint, json=input_data) print(result.text)

if name == "main": main()`

but ,it error log: { $ python ./client.py

{"error":"Invalid json data: b'{\"model_version\": 2, \"data\": {\"keys\": [[11.0], [2.0]], \"features\": [[1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1]]}, \"model_name\": \"tensorflow_template_application_model\"}'"}

}

tobegit3hub commented 6 years ago

Since you run with model_config_file="./examples/model_config_file.json", the model names are not default. In that case, you can not generate json with curl http://localhost:8500/v1/models/default/gen_json.

Please try the following command to replace default with tensorflow_template_application.

curl http://localhost:8500/v1/models/tensorflow_template_application/gen_json