This file contains hidden or 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
poetry add llvmlite -vvv --lock | |
Using virtualenv: /Users/oscardefelice/miniconda3/envs/tempr | |
PyPI: No release information found for llvmlite-0.1, skipping | |
PyPI: 45 packages found for llvmlite * | |
Using version ^0.39.0 for llvmlite | |
Updating dependencies | |
Resolving dependencies... | |
1: fact: dataflows is 0.1.0 | |
1: derived: dataflows |
This file contains hidden or 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
[tool.poetry] | |
name = "dataflows" | |
version = "0.1.0" | |
description = "" | |
authors = ["oscar de felice <[email protected]>"] | |
[tool.poetry.dependencies] | |
python = ">=3.9, <3.10" | |
kedro = "0.18.1" | |
dask = {extras = ["distributed"], version = "^2021.12.0"} |
This file contains hidden or 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
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 | |
WORKDIR /app | |
COPY . /app | |
ENV MODEL_FOLDER=/app/model | |
RUN pip install -r requirements.txt | |
# copy project | |
COPY ./model/ ${MODEL_FOLDER} |
This file contains hidden or 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
from datetime import datetime | |
from typing import List, Optional | |
from pydantic import BaseModel | |
# Inputs | |
class InputData(BaseModel): | |
""" | |
An object to define the input data for the price estimator model. | |
It contains the features we want to use to get a prediction. | |
""" |
This file contains hidden or 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
{ | |
"data": "data.json", | |
"train_test_ratio": 0.2, | |
"normalise": true, | |
"pretrained_model": null, | |
"model_config": { | |
"model_name": "house_pricing_model", | |
"layers": { | |
"first_layer": 64, | |
"second_layer": 64, |
This file contains hidden or 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
# estimator.py | |
import click | |
from utils import read_config, train | |
@click.command() | |
@click.argument('operation') | |
@click.option('--conf', type=click.Path(exists=True)) | |
def main(operation, conf): | |
click.echo(f"{operation} started") |
This file contains hidden or 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
import tensorflow as tf | |
from tensorflow.keras.models import load_model Sequential | |
from tensorflow.keras.layers import Dense | |
import json | |
import numpy as np | |
from sklearn.model_selection import train_test_split | |
def read_config(config_file_path): | |
with open(config_file_path, 'r') as f: |
This file contains hidden or 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
import os | |
import json | |
from .regressor import PriceEstimator | |
MODEL_FOLDER = os.getenv("MODEL_FOLDER") | |
ESTIMATOR = PriceEstimator.from_pretrained(MODEL_FOLDER) | |
def get_predictions(X): | |
return ESTIMATOR.predict(X) |
This file contains hidden or 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
import numpy as np | |
from sklearn.model_selection import train_test_split | |
config = { | |
'data': data, | |
'train_test_ratio': 0.2 | |
} | |
def feature_selection(data): | |
""" |
This file contains hidden or 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
import os | |
from tensorflow.keras.models import load_model | |
from .services import | |
class PriceEstimator: | |
""" | |
PriceEstimator object to collect prediction methods to be accessed | |
by API services. | |
""" |
NewerOlder