Kiuyha commited on
Commit
6d8f72b
·
verified ·
1 Parent(s): beba39b

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -30,7 +30,7 @@ def load_resources():
30
  vectorizer = joblib.load(os.path.join(ARTIFACTS_DIR, 'tfidf_vectorizer.pkl'))
31
 
32
  # Load Price Artifacts
33
- price_scaler = joblib.load(os.path.join(ARTIFACTS_DIR, 'scaler.pkl'))
34
  price_cols = joblib.load(os.path.join(ARTIFACTS_DIR, 'feature_columns.pkl'))
35
 
36
  # Load Models
@@ -40,12 +40,12 @@ def load_resources():
40
  "MLP": joblib.load(os.path.join(ARTIFACTS_DIR, 'MLP_price.pkl'))
41
  }
42
 
43
- return vectorizer, price_scaler, price_cols, price_models, final_stopwords
44
  except Exception as e:
45
  st.error(f"Error loading resources: {e}")
46
  return None, None, None, None, None
47
 
48
- (vectorizer, price_scaler, price_cols,
49
  price_models, final_stopwords) = load_resources()
50
 
51
  @st.cache_data
@@ -217,7 +217,7 @@ if price_models:
217
 
218
  if st.button("Predict Price", type="primary"):
219
  raw_df = prepare_raw_dataframe(base_input, price_cols, vectorizer)
220
- X_scaled = price_scaler.transform(raw_df)
221
 
222
  log_pred = price_models[model_name].predict(X_scaled)[0]
223
  price_pred = np.expm1(log_pred)
 
30
  vectorizer = joblib.load(os.path.join(ARTIFACTS_DIR, 'tfidf_vectorizer.pkl'))
31
 
32
  # Load Price Artifacts
33
+ price_preprocess = joblib.load(os.path.join(ARTIFACTS_DIR, 'scaler.pkl'))
34
  price_cols = joblib.load(os.path.join(ARTIFACTS_DIR, 'feature_columns.pkl'))
35
 
36
  # Load Models
 
40
  "MLP": joblib.load(os.path.join(ARTIFACTS_DIR, 'MLP_price.pkl'))
41
  }
42
 
43
+ return vectorizer, price_preprocess, price_cols, price_models, final_stopwords
44
  except Exception as e:
45
  st.error(f"Error loading resources: {e}")
46
  return None, None, None, None, None
47
 
48
+ (vectorizer, price_preprocess, price_cols,
49
  price_models, final_stopwords) = load_resources()
50
 
51
  @st.cache_data
 
217
 
218
  if st.button("Predict Price", type="primary"):
219
  raw_df = prepare_raw_dataframe(base_input, price_cols, vectorizer)
220
+ X_scaled = price_preprocess.transform(raw_df)
221
 
222
  log_pred = price_models[model_name].predict(X_scaled)[0]
223
  price_pred = np.expm1(log_pred)