Skip to content

Commit

Permalink
fixing tracking uri issue on the api
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelgreca committed Nov 11, 2024
1 parent bda68fc commit 82aab67
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
7 changes: 4 additions & 3 deletions config/settings.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# MODEL SETTINGS
FEATURES: ['Gender_Male', 'Age_q2', 'Age_q4', 'CAEC_Frequently', 'CAEC_Sometimes', 'CAEC_no', 'SMOKE_yes', 'SCC_yes', 'CALC_infrequent_sklearn', 'MTRANS_Public_Transportation', 'MTRANS_Walking', 'MTRANS_infrequent_sklearn', 'IS_1', 'FCVC', 'FAF', 'TUE', 'BMI', 'BMR']
FEATURES: ['Gender_x0_Male', 'Age_x0_q2', 'Age_x0_q4', 'CAEC_x0_Frequently', 'CAEC_x0_Sometimes', 'CAEC_x0_no', 'SMOKE_x0_yes', 'SCC_x0_yes', 'CALC_x0_infrequent_sklearn', 'MTRANS_x0_Public_Transportation', 'MTRANS_x0_Walking', 'MTRANS_x0_infrequent_sklearn', 'IS_x0_1', 'FCVC', 'FAF', 'TUE', 'BMI', 'BMR']
MODEL_NAME: 'xgboost'
MODEL_FLAVOR: 'xgboost'
RUN_ID: 'ff943ce028b1479795153a8f13106894'
EXPERIMENT_ID: '755921522963084808'
RUN_ID: 'e7d3cea9b93b4dd18ae421c402520a2c'
EXPERIMENT_ID: '708342276728582022'
VERSION: '1.0'

# GENERAL SETTINGS
DATA_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/data/'
RAW_FILE_NAME: 'Original_ObesityDataSet.csv'
ARTIFACTS_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/models/artifacts/'
FEATURES_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/models/features/'
RESEARCH_ENVIRONMENT_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/notebooks/'
TARGET_COLUMN: 'NObeyesdad'
LOG_LEVEL: 'INFO'
LOG_PATH: '/media/greca/HD/GitHub/e2e-mlops-project/'
10 changes: 9 additions & 1 deletion src/api.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import pandas as pd
import mlflow
from fastapi import FastAPI

from .data.processing import data_processing_inference
from .config.model import model_settings
from .config.aws import aws_credentials
from .config.settings import general_settings
from .model.inference import ModelServe
from .schema.person import Person

app = FastAPI()

if aws_credentials.EC2 != "YOUR_EC2_INSTANCE_URL":
mlflow.set_tracking_uri(f"http://{aws_credentials.EC2}:5000")
else:
mlflow.set_tracking_uri(f"http://127.0.0.1:5000")

@app.get("/version")
def check_versions():
with open("../notebooks/VERSION", "r", encoding="utf-8") as f:
with open(f"{general_settings.RESEARCH_ENVIRONMENT_PATH}/VERSION", "r", encoding="utf-8") as f:
code_version = f.readline().strip()

return {
Expand Down
1 change: 1 addition & 0 deletions src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class GeneralSettings(BaseModel):
TARGET_COLUMN: str
LOG_LEVEL: str
LOG_PATH: DirectoryPath
RESEARCH_ENVIRONMENT_PATH: DirectoryPath

general_settings = GeneralSettings(
**read_yaml_credentials_file(
Expand Down

0 comments on commit 82aab67

Please sign in to comment.