This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update local packages | |
sudo apt-get update -y | |
# install dependencies | |
sudo apt-get install -y python3-pip python3-dev python3-venv | |
# create the python enviroment | |
python3 -m venv pyenv | |
# activate a virtual environment¶ | |
source ./pyenv/bin/activate | |
#install packages | |
pip install -r ./src/score_interactive_endpoint/requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This module runs the entire Dash Application | |
''' | |
import dash_table | |
import dash_core_components as component | |
import dash_html_components as html | |
from dash.dependencies import Input, Output | |
from app import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This module contains the layout of the application | |
''' | |
import dash_table | |
import dash_core_components as component | |
import dash_html_components as html | |
#Customerid Input | |
c_id_component = component.Input(id="uid", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This module contains the predict callback | |
''' | |
from dash.dependencies import Input, Output | |
from app import * | |
@app.callback([Output('table', component_property='columns'), Output('table', component_property='data')],[Input(component_id='uid', component_property='value')]) | |
def predict(uid): | |
columns = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
└── src | |
└── score_interactive_endpoint | |
├── Dockerfile | |
├── app.py | |
├── callbacks.py | |
├── layouts.py | |
├── model | |
│ └── model_aa0lcc9j.pkl | |
├── requirements.txt | |
└── run.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model_name = 'Champion' | |
artifact_path = "model" | |
model_uri = "runs:/{run_id}/{artifact_path}".format(run_id=run_id, artifact_path=artifact_path) | |
model_details = mlflow.register_model(model_uri=model_uri, name=model_name) | |
client = MlflowClient() | |
client.update_registered_model( | |
name=model_details.name, | |
description="This model provides recommendation for specific users and items based on purchase data. The data consists of user transactions" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def reader(df): | |
""" | |
return a data parsed with Reader class | |
args: | |
df: pandas dataframe | |
returns: | |
data parsed | |
""" | |
mindata = df.rating.min() | |
maxdata = df.rating.max() |
NewerOlder