vetiver.write_app#

vetiver.write_app(board, pin_name: str, version: Optional[str] = None, file: str = 'app.py', overwrite=False)#

Write VetiverAPI app to a file

Parameters
  • board – API to be written

  • pin_name (string) – Name of pin containing VetiverModel

  • version – Pins version of VetiverModel

  • file – Name of file

Example

>>> import vetiver
>>> import tempfile
>>> import pins
>>> tmp = tempfile.TemporaryDirectory()
>>> board = pins.board_temp(allow_pickle_read=True)
>>> X, y = vetiver.get_mock_data()
>>> model = vetiver.get_mock_model().fit(X, y)
>>> v = vetiver.VetiverModel(model = model, model_name = "my_model", ptype_data = X)
>>> vetiver.vetiver_pin_write(board, v)
>>> vetiver.write_app(board,
...     "my_model",
...     file = tmp.name + "/app.py")