Srinivas1969 commited on
Commit
b6f7918
·
1 Parent(s): d9ec990

Deploy Streamlit app

Browse files
Files changed (3) hide show
  1. Dockerfile +5 -18
  2. app.py +33 -0
  3. requirements.txt +6 -2
Dockerfile CHANGED
@@ -1,20 +1,7 @@
1
- FROM python:3.13.5-slim
2
 
 
3
  WORKDIR /app
4
-
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- curl \
8
- git \
9
- && rm -rf /var/lib/apt/lists/*
10
-
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
13
-
14
- RUN pip3 install -r requirements.txt
15
-
16
- EXPOSE 8501
17
-
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
19
-
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
 
2
+ FROM python:3.10-slim
3
  WORKDIR /app
4
+ COPY requirements.txt .
5
+ RUN pip install -r requirements.txt
6
+ COPY . .
7
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
 
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import streamlit as st
3
+ import pandas as pd
4
+ import joblib
5
+ from huggingface_hub import hf_hub_download
6
+
7
+ MODEL_REPO = "Srinivas1969/Tourism-Model"
8
+ MODEL_FILE = "rf_model.joblib"
9
+
10
+ @st.cache_resource
11
+ def load_model():
12
+ path = hf_hub_download(repo_id=MODEL_REPO, filename=MODEL_FILE, repo_type="model")
13
+ return joblib.load(path)
14
+
15
+ model = load_model()
16
+
17
+ st.title("Wellness Tourism Package Prediction")
18
+
19
+ st.write("Enter customer details:")
20
+
21
+ # NOTE: Use encoded columns
22
+ # For simplicity, we accept numeric inputs only
23
+ # (You can expand this to full categorical UI later)
24
+
25
+ inputs = {}
26
+ for col in ['Unnamed: 0', 'Age', 'CityTier', 'DurationOfPitch', 'NumberOfPersonVisiting', 'NumberOfFollowups', 'PreferredPropertyStar', 'NumberOfTrips', 'Passport', 'PitchSatisfactionScore', 'OwnCar', 'NumberOfChildrenVisiting', 'MonthlyIncome', 'TypeofContact_Self Enquiry', 'Occupation_Large Business', 'Occupation_Salaried', 'Occupation_Small Business', 'Gender_Female', 'Gender_Male', 'ProductPitched_Deluxe', 'ProductPitched_King', 'ProductPitched_Standard', 'ProductPitched_Super Deluxe', 'MaritalStatus_Married', 'MaritalStatus_Single', 'MaritalStatus_Unmarried', 'Designation_Executive', 'Designation_Manager', 'Designation_Senior Manager', 'Designation_VP']:
27
+ inputs[col] = st.number_input(col, value=0)
28
+
29
+ df = pd.DataFrame([inputs])
30
+
31
+ if st.button("Predict"):
32
+ pred = model.predict(df)[0]
33
+ st.success("Will Purchase" if pred==1 else "Will Not Purchase")
requirements.txt CHANGED
@@ -1,3 +1,7 @@
1
- altair
 
2
  pandas
3
- streamlit
 
 
 
 
1
+
2
+ streamlit
3
  pandas
4
+ numpy
5
+ scikit-learn
6
+ joblib
7
+ huggingface_hub