Upload folder using huggingface_hub
Browse files- Dockerfile +15 -12
- app.py +11 -61
Dockerfile
CHANGED
|
@@ -1,20 +1,23 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
| 1 |
+
# Use a minimal base image with Python 3.9 installed
|
| 2 |
+
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Set the working directory inside the container to /app
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy all files from the current directory on the host to the container's /app directory
|
| 8 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
# Install Python dependencies listed in requirements.txt
|
| 11 |
RUN pip3 install -r requirements.txt
|
| 12 |
|
| 13 |
+
RUN useradd -m -u 1000 user
|
| 14 |
+
USER user
|
| 15 |
+
ENV HOME=/home/user \
|
| 16 |
+
PATH=/home/user/.local/bin:$PATH
|
| 17 |
+
|
| 18 |
+
WORKDIR $HOME/app
|
| 19 |
|
| 20 |
+
COPY --chown=user . $HOME/app
|
| 21 |
|
| 22 |
+
# Define the command to run the Streamlit app on port "8501" and make it accessible externally
|
| 23 |
+
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
|
app.py
CHANGED
|
@@ -10,78 +10,28 @@ model = joblib.load(model_path)
|
|
| 10 |
# Streamlit UI for Machine Failure Prediction
|
| 11 |
st.title("Customer Package Purchase Prediction App")
|
| 12 |
st.write("""
|
| 13 |
-
This application predicts whether a customer will purchase the Wellness Tourism Package.
|
| 14 |
Please enter the data below to get a prediction.
|
| 15 |
""")
|
| 16 |
|
| 17 |
# User input
|
| 18 |
TypeofContact = st.selectbox("Contact Type", ["Self Enquiry", "Company Invited"])
|
| 19 |
-
Age = st.number_input("Age", min_value=18, max_value=90, value=
|
| 20 |
-
CityTier = st.number_input("CityTier",
|
| 21 |
DurationOfPitch = st.number_input("DurationOfPitch", min_value=1, max_value=60, value=15)
|
| 22 |
-
NumberOfPersonVisiting = st.number_input("Number of Persons Visiting", min_value=1, max_value=10, value=2)
|
| 23 |
-
NumberOfFollowups = st.number_input("Number of Followups", min_value=0, max_value=10, value=2)
|
| 24 |
-
PreferredPropertyStar = st.selectbox(
|
| 25 |
-
"Preferred Property Star", [1, 2, 3, 4, 5]
|
| 26 |
-
)
|
| 27 |
-
|
| 28 |
-
NumberOfTrips = st.number_input(
|
| 29 |
-
"Number of Trips", min_value=0, max_value=50, value=5
|
| 30 |
-
)
|
| 31 |
-
|
| 32 |
-
PitchSatisfactionScore = st.selectbox(
|
| 33 |
-
"Pitch Satisfaction Score", [1, 2, 3, 4, 5]
|
| 34 |
-
)
|
| 35 |
-
|
| 36 |
-
NumberOfChildrenVisiting = st.number_input(
|
| 37 |
-
"Number of Children Visiting", min_value=0, max_value=10, value=0
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
MonthlyIncome = st.number_input(
|
| 41 |
-
"Monthly Income", min_value=1000, max_value=1000000, value=25000
|
| 42 |
-
)
|
| 43 |
Occupation = st.selectbox("Occupation", ["Salaried", "Free Lancer", "Small Business", "Large Business"])
|
| 44 |
Gender = st.selectbox("Gender", ["Female", "Male", "Fe Male"])
|
| 45 |
-
MaritalStatus = st.selectbox(
|
| 46 |
-
"Marital Status",
|
| 47 |
-
["Single", "Married", "Divorced", "Unmarried"]
|
| 48 |
-
)
|
| 49 |
-
|
| 50 |
-
Designation = st.selectbox(
|
| 51 |
-
"Designation",
|
| 52 |
-
["Executive", "Manager", "Senior Manager", "AVP", "VP"]
|
| 53 |
-
)
|
| 54 |
-
|
| 55 |
-
ProductPitched = st.selectbox(
|
| 56 |
-
"Product Pitched",
|
| 57 |
-
["Basic", "Standard", "Deluxe", "Super Deluxe", "Premium"]
|
| 58 |
-
)
|
| 59 |
-
|
| 60 |
-
Passport = st.selectbox("Has Passport?", ["0", "1"])
|
| 61 |
-
|
| 62 |
-
OwnCar = st.selectbox("Owns a Car?", ["0", "1"])
|
| 63 |
|
| 64 |
# Assemble input into DataFrame
|
| 65 |
input_data = pd.DataFrame([{
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
"PitchSatisfactionScore": PitchSatisfactionScore,
|
| 75 |
-
"NumberOfChildrenVisiting": NumberOfChildrenVisiting,
|
| 76 |
-
"MonthlyIncome": MonthlyIncome,
|
| 77 |
-
"Occupation": Occupation,
|
| 78 |
-
"Gender": Gender,
|
| 79 |
-
"MaritalStatus": MaritalStatus,
|
| 80 |
-
"Designation": Designation,
|
| 81 |
-
"ProductPitched": ProductPitched,
|
| 82 |
-
"Passport": Passport,
|
| 83 |
-
"OwnCar": OwnCar
|
| 84 |
-
}])
|
| 85 |
|
| 86 |
if st.button("Predict Purchase"):
|
| 87 |
prediction = model.predict(input_data)[0]
|
|
|
|
| 10 |
# Streamlit UI for Machine Failure Prediction
|
| 11 |
st.title("Customer Package Purchase Prediction App")
|
| 12 |
st.write("""
|
| 13 |
+
This application predicts whether a customer will purchase the newly introduced Wellness Tourism Package before contacting them based on different parameters.
|
| 14 |
Please enter the data below to get a prediction.
|
| 15 |
""")
|
| 16 |
|
| 17 |
# User input
|
| 18 |
TypeofContact = st.selectbox("Contact Type", ["Self Enquiry", "Company Invited"])
|
| 19 |
+
Age = st.number_input("Age", min_value=18.0, max_value=90.0, value=37.0, step=1)
|
| 20 |
+
CityTier = st.number_input("CityTier", min_value=1.0, max_value=3.0, value=3.0, step=1.0)
|
| 21 |
DurationOfPitch = st.number_input("DurationOfPitch", min_value=1, max_value=60, value=15)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
Occupation = st.selectbox("Occupation", ["Salaried", "Free Lancer", "Small Business", "Large Business"])
|
| 23 |
Gender = st.selectbox("Gender", ["Female", "Male", "Fe Male"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Assemble input into DataFrame
|
| 26 |
input_data = pd.DataFrame([{
|
| 27 |
+
'TypeofContact': typeofcontact,
|
| 28 |
+
'Age': age,
|
| 29 |
+
'CityTier': citytier,
|
| 30 |
+
'DurationOfPitch': durationofpitch,
|
| 31 |
+
'Occupation': occupation,
|
| 32 |
+
'Gender': gender
|
| 33 |
+
}])
|
| 34 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
if st.button("Predict Purchase"):
|
| 37 |
prediction = model.predict(input_data)[0]
|