Skip to content

Commit

Permalink
Add advanced usage for using th class api
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferSkare committed Jun 26, 2024
1 parent 7e8bfbb commit 565fbb9
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,37 @@ mlfmu compile --fmu-source-path path/to/generated/source
```

### Using class
TODO: Write about possibility of using the class in a script for the same behavior

In addition to the command line interface one can use the same functionality of the tool through a python class.

1. Import `MlFmuBuilder` and create instance of it
```python
from mlfmu.api import MlFmuBuilder
from pathlib import Path

builder = MlFmuBuilder(
ml_model_file = Path("path/to/model.onnx")
interface_file = Path("path/to/interface.json")
)
```
2. Call the same commands using the class

- Run `build`

```python
builder.build()
```

- Run `codegen` and then `compile`

```python
builder.generate()

# Do something ...

builder.compile()
```


## Development Setup

Expand Down

0 comments on commit 565fbb9

Please sign in to comment.