EdBoy2202 commited on
Commit
91ac79b
·
verified ·
1 Parent(s): 2266c9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -9,6 +9,7 @@ from sklearn.preprocessing import LabelEncoder
9
  import requests # Add this at the top with other imports
10
  from io import BytesIO
11
  import gdown
 
12
 
13
  # --- Set page configuration ---
14
  st.set_page_config(
@@ -218,8 +219,12 @@ def load_model_and_encodings():
218
  try:
219
  # Show loading message
220
  with st.spinner('Loading model...'):
221
- model_content = download_file_from_google_drive(model_file_id)
222
- model = joblib.load(BytesIO(model_content))
 
 
 
 
223
 
224
  # Load data for encodings
225
  original_data = load_datasets()
 
9
  import requests # Add this at the top with other imports
10
  from io import BytesIO
11
  import gdown
12
+ from huggingface_hub import hf_hub_download
13
 
14
  # --- Set page configuration ---
15
  st.set_page_config(
 
219
  try:
220
  # Show loading message
221
  with st.spinner('Loading model...'):
222
+ try:
223
+ model_content = hf_hub_download(repo_id="EdBoy2202/car_prediction_model", filename="car_price_modelv3.pkl")
224
+ model = joblib.load(BytesIO(model_content))
225
+ except:
226
+ model_content = download_file_from_google_drive(model_file_id)
227
+ model = joblib.load(BytesIO(model_content))
228
 
229
  # Load data for encodings
230
  original_data = load_datasets()