Upload folder using huggingface_hub
Browse files- Dockerfile +23 -0
- app.py +68 -0
- requirements.txt +7 -0
Dockerfile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
%%writefile tourism_project/deployment/app.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import pandas as pd
|
| 4 |
+
from huggingface_hub import hf_hub_download
|
| 5 |
+
import joblib
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
model_path = hf_hub_download(repo_id="divshiva1988/Tourism_package_acceptance_predictor_model", filename="best_Tourism_package_acceptance_predictor_model_v1.joblib")
|
| 9 |
+
model = joblib.load(model_path)
|
| 10 |
+
|
| 11 |
+
#model=joblib.load("https://huggingface.co/divshiva1988/Tourism_package_acceptance_predictor_model/resolve/main/best_Tourism_package_acceptance_predictor_model_v1.joblib")
|
| 12 |
+
|
| 13 |
+
# Streamlit UI
|
| 14 |
+
st.title(" Tourism package acceptance Prediction")
|
| 15 |
+
st.write("""
|
| 16 |
+
This application predicts the acceptance of a Tourism package.
|
| 17 |
+
""")
|
| 18 |
+
|
| 19 |
+
# User input
|
| 20 |
+
Designation = st.selectbox("Designation", ["AVP", "Executive", "Manager", "SENSenior Manager", "VP"])
|
| 21 |
+
Gender = st.selectbox("Gender", ["Male", "Female"])
|
| 22 |
+
MaritalStatus = st.selectbox("MaritalStatus", ["Divorced", "Married", "Single", "UNmarried"])
|
| 23 |
+
ProductPitched = st.selectbox("ProductPitched", ["Basic", "Deluxe", "King","Standard","Super Deluxe"])
|
| 24 |
+
PreferredPropertyStar = st.selectbox("PreferredPropertyStar", [3,4,5])
|
| 25 |
+
Passport = st.selectbox("Passport", [0,1])
|
| 26 |
+
PitchSatisfactionScore = st.selectbox("PitchSatisfactionScore", [1,2,3,4,5])
|
| 27 |
+
OwnCar = st.selectbox("OwnCar", [0,1])
|
| 28 |
+
NumberOfChildrenVisiting = st.selectbox("NumberOfChildrenVisiting", [0,1,2,3])
|
| 29 |
+
Occupation = st.selectbox("Occupation", ["Free Lancer","Large Business", "Salaried", "Small Business"])
|
| 30 |
+
TypeofContact = st.selectbox("TypeofContact", ["Company Invited", "Self Enquiry"])
|
| 31 |
+
|
| 32 |
+
Age = st.number_input("Age of person", min_value=18.0, max_value=61.0, value=16.0, step=1)
|
| 33 |
+
CityTier = st.number_input("CityTier", min_value=1, max_value=3, value=1, step=1)
|
| 34 |
+
DurationOfPitch = st.number_input("DurationOfPitch", min_value=5, max_value=127, value=5, step=5)
|
| 35 |
+
NumberOfFollowups = st.number_input("NumberOfFollowups", min_value=1, max_value=6, value=1)
|
| 36 |
+
NumberOfPersonVisiting = st.number_input("NumberOfPersonVisiting", min_value=1, max_value=5, value=5, step=1)
|
| 37 |
+
NumberOfTrips = st.number_input("NumberOfTrips", min_value=1, max_value=22, value=1)
|
| 38 |
+
MonthlyIncome = st.number_input("MonthlyIncome", min_value=1000,max_value=99000, value=1000,step=1000)
|
| 39 |
+
|
| 40 |
+
# Assemble input into DataFrame
|
| 41 |
+
input_data = pd.DataFrame([{
|
| 42 |
+
'Designation': Designation,
|
| 43 |
+
'Gender': Gender,
|
| 44 |
+
'MaritalStatus': MaritalStatus,
|
| 45 |
+
'ProductPitched': ProductPitched,
|
| 46 |
+
'PreferredPropertyStar': PreferredPropertyStar,
|
| 47 |
+
'Passport': Passport,
|
| 48 |
+
'PitchSatisfactionScore': PitchSatisfactionScore,
|
| 49 |
+
'OwnCar': OwnCar,
|
| 50 |
+
'NumberOfChildrenVisiting': NumberOfChildrenVisiting,
|
| 51 |
+
'Occupation': Occupation,
|
| 52 |
+
'TypeofContact': TypeofContact,
|
| 53 |
+
'Age': Age,
|
| 54 |
+
'CityTier': CityTier,
|
| 55 |
+
'DurationOfPitch': DurationOfPitch,
|
| 56 |
+
'NumberOfFollowups': NumberOfFollowups,
|
| 57 |
+
'NumberOfPersonVisiting': NumberOfPersonVisiting,
|
| 58 |
+
'PreferredPropertyStar': PreferredPropertyStar,
|
| 59 |
+
'NumberOfTrips': NumberOfTrips,
|
| 60 |
+
'MonthlyIncome': MonthlyIncome
|
| 61 |
+
|
| 62 |
+
}])
|
| 63 |
+
|
| 64 |
+
# Predict button
|
| 65 |
+
if st.button("Predict Tourism package acceptance"):
|
| 66 |
+
prediction = model.predict(input_data)[0]
|
| 67 |
+
st.subheader("Prediction Result:")
|
| 68 |
+
st.success(f"Tourism package has strong chances of getting : **${prediction:,.2f} **")
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==2.2.2
|
| 2 |
+
huggingface_hub==0.32.6
|
| 3 |
+
streamlit==1.43.2
|
| 4 |
+
joblib==1.5.1
|
| 5 |
+
scikit-learn==1.6.0
|
| 6 |
+
xgboost==2.1.4
|
| 7 |
+
mlflow==3.0.1
|