commit segmentation

This commit is contained in:
Alexis REVELLE 2024-03-20 12:07:24 +00:00
parent 605876dfb1
commit 3d03965084
2 changed files with 38 additions and 0 deletions

18
0_6_Segmentation.py Normal file
View File

@ -0,0 +1,18 @@
import pandas as pd
import numpy as np
import os
import io
import s3fs
import re
import pickle
import warnings
exec(open('utils_segmentation.py').read())
warnings.filterwarnings('ignore')
# Load Model
model = load_model(type_of_activity, model)

20
utils_segmentation.py Normal file
View File

@ -0,0 +1,20 @@
import pandas as pd
import numpy as np
import os
import io
import s3fs
import re
import pickle
import warnings
def load_model(type_of_activity, model):
BUCKET = f"projet-bdc2324-team1/Output_model/{type_of_activity}/{model}/"
filename = model + '.pkl'
file_path = BUCKET + filename
with fs.open(file_path, mode="rb") as f:
model_bytes = f.read()
model = pickle.loads(model_bytes)
return model