write_app

write_app(
    board,
    pin_name: str,
    version: str = None,
    file: str = 'app.py',
    overwrite,
)

Write VetiverAPI app to a file

Parameters

board :

API to be written

pin_name : string

Name of pin containing VetiverModel

version : str = None

Pins version of VetiverModel

file : str = 'app.py'

Name of file

Examples

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, "my_model", prototype_data = X)

vetiver.vetiver_pin_write(board, v)
vetiver.write_app(board,
    "my_model",
    file = tmp.name + "/app.py")
Model Cards provide a framework for transparent, responsible reporting. 
 Use the vetiver `.qmd` Quarto template as a place to start, 
 with vetiver.model_card()
Writing pin:
Name: 'my_model'
Version: 20241210T193424Z-015fa