<jupyter_start><jupyter_text>Definição MLFLOW![](https://miro.medium.com/max/1200/0*InKnQLBf5eqzvIbP)  Treinando iris flower<jupyter_code>from os import chdir
chdir("../")

# ilustrativo 
!python src/models/train_model.py --test_size 0.2 --random_state 32
!ls<jupyter_output>LICENSE    artifacts  mlflow.db  notebooks   reports
README.md  data       models	 references  src<jupyter_text>CRIANDO REGISTRY DO MODELO [![Everything Is AWESOME](https://img.youtube.com/vi/HV4eIPjOF-Q/0.jpg)](https://www.youtube.com/watch?v=HV4eIPjOF-Q "Everything Is AWESOME") --- Build model  ``` zshfoo@bar:~$ mlflow models build-docker -m 'models:/iris-model-api/Production' -n "iris-api" ```![image.png](attachment:e7e101ec-0e38-422e-9036-6cec56b4484c.png)  Run Model on Docker<jupyter_code>!sudo docker run -d -p 5001:8080 iris-api  # vai rodar a imagem
!sudo docker logs 7cba49526b110bc69fd3ad02a44feacc5e07dcafdfcf7dc6e59e2cc9a635b902<jupyter_output>pip 20.2.4 from /miniconda/lib/python3.8/site-packages/pip (python 3.8)
Python 3.8.5
1.13.1
[2021-05-10 16:20:18 +0000] [26] [INFO] Starting gunicorn 20.1.0
[2021-05-10 16:20:18 +0000] [26] [INFO] Listening at: http://127.0.0.1:8000 (26)
[2021-05-10 16:20:18 +0000] [26] [INFO] Using worker: gevent
[2021-05-10 16:20:18 +0000] [39] [INFO] Booting worker with pid: 39
[2021-05-10 16:20:18 +0000] [40] [INFO] Booting worker with pid: 40
[2021-05-10 16:20:18 +0000] [41] [INFO] Booting worker with pid: 41
[2021-05-10 16:20:18 +0000] [42] [INFO] Booting worker with pid: 42<jupyter_text>Testando API<jupyter_code>!python src/models/predict_model.py<jupyter_output>2021-05-10 16:20:37.500670 result api:  (1, 'versicolor') <class 'list'><jupyter_text>stop docker<jupyter_code>!sudo docker stop 7cba49526b110bc69fd3ad02a44feacc5e07dcafdfcf7dc6e59e2cc9a635b902
!sudo docker rm 7cba49526b110bc69fd3ad02a44feacc5e07dcafdfcf7dc6e59e2cc9a635b902<jupyter_output>7cba49526b110bc69fd3ad02a44feacc5e07dcafdfcf7dc6e59e2cc9a635b902
7cba49526b110bc69fd3ad02a44feacc5e07dcafdfcf7dc6e59e2cc9a635b902
{'fraction_non_alphanumeric': 0.13194444444444445, 'fraction_numerical': 0.19692460317460317, 'mean_word_length': 6.255395683453237, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '229551', 'license': 'FTL', 'n_tokens_mistral': 1137, 'n_tokens_neox': 895, 'n_words': 155, 'path': 'notebooks/iris-flower-mlflow.ipynb', 'repo_name': 'heermarinho/iris-flow-model-mlflow', 'size': '2016'}