Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,13 +82,14 @@ os.makedirs(app.config['MODEL_FOLDER'], exist_ok=True)
|
|
| 82 |
# Prediction analysis models loaded from Hugging Face.
|
| 83 |
src_path = hf_hub_download(
|
| 84 |
repo_id="WebashalarForML/Diamond_model_",
|
| 85 |
-
filename="models_list/mkble/
|
| 86 |
cache_dir=MODEL_FOLDER
|
| 87 |
)
|
| 88 |
-
dst_path = os.path.join(MODEL_FOLDER, "
|
| 89 |
shutil.copy(src_path, dst_path)
|
| 90 |
makable_model = load(dst_path)
|
| 91 |
|
|
|
|
| 92 |
src_path = hf_hub_download(
|
| 93 |
repo_id="WebashalarForML/Diamond_model_",
|
| 94 |
filename="models_list/grd/StackingRegressor_best_pipeline_grd_0_to_1.01.pkl",
|
|
@@ -117,7 +118,7 @@ src_path = hf_hub_download(
|
|
| 117 |
dst_path = os.path.join(MODEL_FOLDER, "StackingRegressor_best_pipeline_gia_0_to_1.01.pkl")
|
| 118 |
shutil.copy(src_path, dst_path)
|
| 119 |
gia_model = load(dst_path)
|
| 120 |
-
|
| 121 |
|
| 122 |
#classsification model on the task
|
| 123 |
src_path = hf_hub_download(
|
|
@@ -133,9 +134,9 @@ mkble_amt_class_model = load(dst_path)
|
|
| 133 |
|
| 134 |
|
| 135 |
print("makable_model type:", type(makable_model))
|
| 136 |
-
print("grade_model type:", type(grade_model))
|
| 137 |
-
print("bygrade_model type:", type(bygrade_model))
|
| 138 |
-
print("gia_model type:", type(gia_model))
|
| 139 |
print("================================")
|
| 140 |
print("mkble_amt_class_model type:", type(mkble_amt_class_model))
|
| 141 |
|
|
@@ -260,7 +261,9 @@ def process_dataframe(df):
|
|
| 260 |
|
| 261 |
# Create two DataFrames: one for prediction and one for classification.
|
| 262 |
df_pred = df[required_columns].copy()
|
|
|
|
| 263 |
df_pred[['EngBlk', 'EngWht', 'EngOpen', 'EngPav']]=df_pred[['EngBlk', 'EngWht', 'EngOpen', 'EngPav']].fillna("NA")
|
|
|
|
| 264 |
df_class = df[required_columns_2].fillna("NA").copy()
|
| 265 |
|
| 266 |
# Transform categorical columns for prediction DataFrame using the label encoders.
|
|
|
|
| 82 |
# Prediction analysis models loaded from Hugging Face.
|
| 83 |
src_path = hf_hub_download(
|
| 84 |
repo_id="WebashalarForML/Diamond_model_",
|
| 85 |
+
filename="models_list/mkble/DecisionTree_best_pipeline_mkble_0_to_0.99.pkl",
|
| 86 |
cache_dir=MODEL_FOLDER
|
| 87 |
)
|
| 88 |
+
dst_path = os.path.join(MODEL_FOLDER, "DecisionTree_best_pipeline_mkble_0_to_0.99.pkl")
|
| 89 |
shutil.copy(src_path, dst_path)
|
| 90 |
makable_model = load(dst_path)
|
| 91 |
|
| 92 |
+
'''
|
| 93 |
src_path = hf_hub_download(
|
| 94 |
repo_id="WebashalarForML/Diamond_model_",
|
| 95 |
filename="models_list/grd/StackingRegressor_best_pipeline_grd_0_to_1.01.pkl",
|
|
|
|
| 118 |
dst_path = os.path.join(MODEL_FOLDER, "StackingRegressor_best_pipeline_gia_0_to_1.01.pkl")
|
| 119 |
shutil.copy(src_path, dst_path)
|
| 120 |
gia_model = load(dst_path)
|
| 121 |
+
'''
|
| 122 |
|
| 123 |
#classsification model on the task
|
| 124 |
src_path = hf_hub_download(
|
|
|
|
| 134 |
|
| 135 |
|
| 136 |
print("makable_model type:", type(makable_model))
|
| 137 |
+
#print("grade_model type:", type(grade_model))
|
| 138 |
+
#print("bygrade_model type:", type(bygrade_model))
|
| 139 |
+
#print("gia_model type:", type(gia_model))
|
| 140 |
print("================================")
|
| 141 |
print("mkble_amt_class_model type:", type(mkble_amt_class_model))
|
| 142 |
|
|
|
|
| 261 |
|
| 262 |
# Create two DataFrames: one for prediction and one for classification.
|
| 263 |
df_pred = df[required_columns].copy()
|
| 264 |
+
df_pred = df_pred[(df_pred[['EngCts']] > 0.00).all(axis=1) & (df_pred[['EngCts']] <= 0.99).all(axis=1)]
|
| 265 |
df_pred[['EngBlk', 'EngWht', 'EngOpen', 'EngPav']]=df_pred[['EngBlk', 'EngWht', 'EngOpen', 'EngPav']].fillna("NA")
|
| 266 |
+
df_pred = df_pred[(df_pred[['MkblAmt', 'GrdAmt', 'ByGrdAmt', 'GiaAmt', 'EngCts']] != 0).all(axis=1)]
|
| 267 |
df_class = df[required_columns_2].fillna("NA").copy()
|
| 268 |
|
| 269 |
# Transform categorical columns for prediction DataFrame using the label encoders.
|