A Flask server for serving predictions from a single AllenNLP model. It also includes a very, very bare-bones web front-end for exploring predictions (or you can provide your own).

For example, if you have your own predictor and model in the my_stuff package, and you want to use the default HTML, you could run this like

` python -m allennlp.service.server_simple     --archive-path allennlp/tests/fixtures/bidaf/serialization/model.tar.gz     --predictor machine-comprehension     --title "Demo of the Machine Comprehension Text Fixture"     --field-name question --field-name passage `

allennlp.service.server_simple.make_app(predictor: allennlp.predictors.predictor.Predictor, field_names: typing.List[str] = None, static_dir: str = None, sanitizer: typing.Callable[typing.Dict[str, typing.Any], typing.Dict[str, typing.Any]] = None, title: str = 'AllenNLP Demo') →[source]

Creates a Flask app that serves up the provided Predictor along with a front-end for interacting with it.

If you want to use the built-in bare-bones HTML, you must provide the field names for the inputs (which will be used both as labels and as the keys in the JSON that gets sent to the predictor).

If you would rather create your own HTML, call it index.html and provide its directory as static_dir. In that case you don’t need to supply the field names – that information should be implicit in your demo site. (Probably the easiest thing to do is just start with the bare-bones HTML and modify it.)

In addition, if you want somehow transform the JSON prediction (e.g. by removing probabilities or logits) you can do that by passing in a sanitizer function.