Divyap90 commited on
Commit
eac29a5
·
verified ·
1 Parent(s): 7e8992e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -6,7 +6,7 @@ import os
6
  import joblib
7
  from huggingface_hub import hf_hub_download
8
 
9
- # MUST be the first Streamlit command
10
  st.set_page_config(page_title="Wellness Tourism Package Predictor", layout="wide")
11
 
12
  # Define the Hugging Face Model Repository ID
@@ -22,17 +22,15 @@ def load_model():
22
  filename="model.joblib",
23
  repo_type="model"
24
  )
25
-
26
- st.write(f"Loading model from local path: {model_path}")
27
  model = joblib.load(model_path)
28
-
29
- st.success("✅ Model loaded successfully")
30
  return model
31
  except Exception as e:
32
  st.error(f"Error loading model: {e}")
33
  st.stop()
34
 
35
- # Load model AFTER set_page_config
36
  model = load_model()
37
 
38
  st.title("Wellness Tourism Package Purchase Predictor")
 
6
  import joblib
7
  from huggingface_hub import hf_hub_download
8
 
9
+ # MUST be the VERY first Streamlit command
10
  st.set_page_config(page_title="Wellness Tourism Package Predictor", layout="wide")
11
 
12
  # Define the Hugging Face Model Repository ID
 
22
  filename="model.joblib",
23
  repo_type="model"
24
  )
25
+
26
+ # Load the model without using st commands inside the function
27
  model = joblib.load(model_path)
 
 
28
  return model
29
  except Exception as e:
30
  st.error(f"Error loading model: {e}")
31
  st.stop()
32
 
33
+ # Load model
34
  model = load_model()
35
 
36
  st.title("Wellness Tourism Package Purchase Predictor")