#### Model file upload

Model files have to be saved as a .pkl file in 80_Modelle_BIC.
For upload the upload script has to be opened (can be in every environment). The name of the model file has to be entered wih the .pkl ending in the first command and without .pkl in the second.

#### Adding new model scripts

Open Spyder in the base environment and open the model.py within.

- Enter model file name without .pkl in fetchData
- Add new prediction function below others
- duplicate another @app.route and rename according to desired route name and prediction function name

#### Testing locally

To test the model Python script locally, you need to execute it in the base environment, in which all necessary packages have to be installed. Note that Spyder also has to be opened in the base environment.

- Open a separate Anaconda Prompt and cd into the definma-UI folder
- Adapt the model-mock.json at definma-UI/assets/ and enter the new model URL and name
- Execute "python -m http.server" in the Anaconda Prompt
- Execute the model.py script in Spyder
- Navigate to http://localhost:8000 in the browser
- If there are problems with cached data, open the Browser developer console (Ctrl+Shift+I) and tick "Disable cache" in the Network tab. The console then has to stay open.

#### Model script upload

In the Windows Powershell:

- cf login (only at the first time)
- API endpoint: https://api.sys.de1.bosch-iot-cloud.com
- Enter email with .de.bosch.com
- Enter BIC password
- Select space to upload to (currently 3 - development)
- cd into the folder containing the manifest.yaml (here is also model.py)
- cf push

After upload the new model details have to be entered in the UI.