Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +8 -1
- app.py +5 -4
- requirements.txt +1 -1
Dockerfile
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim
|
| 2 |
WORKDIR /app
|
| 3 |
COPY requirements.txt .
|
| 4 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 5 |
COPY app.py .
|
| 6 |
-
CMD ["streamlit", "run", "app.py", "--server.port=
|
|
|
|
| 1 |
+
# FROM python:3.9-slim
|
| 2 |
+
# WORKDIR /app
|
| 3 |
+
# COPY . .
|
| 4 |
+
# COPY requirements.txt .
|
| 5 |
+
# COPY app.py .
|
| 6 |
+
# RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 7 |
+
# CMD ["streamlit", "run", "app.py", "server.address=0.0.0.0", "server.port=8501"]
|
| 8 |
FROM python:3.9-slim
|
| 9 |
WORKDIR /app
|
| 10 |
COPY requirements.txt .
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
COPY app.py .
|
| 13 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7862", "--server.address=0.0.0.0"]
|
app.py
CHANGED
|
@@ -19,8 +19,8 @@ tenure = st.number_input("Tenure (Months with the company)", min_value=0, value=
|
|
| 19 |
MonthlyCharges = st.number_input("Monthly Charges", min_value=0.0, value=50.0)
|
| 20 |
TotalCharges = st.number_input("Total Charges", min_value=0.0, value=600.0)
|
| 21 |
|
| 22 |
-
# Convert
|
| 23 |
-
customer_data = {
|
| 24 |
'SeniorCitizen': 1 if SeniorCitizen == "Yes" else 0,
|
| 25 |
'Partner':Partner,
|
| 26 |
'Dependents': Dependents,
|
|
@@ -31,7 +31,8 @@ customer_data = {
|
|
| 31 |
'PaymentMethod': PaymentMethod,
|
| 32 |
'MonthlyCharges': MonthlyCharges,
|
| 33 |
'TotalCharges': TotalCharges
|
| 34 |
-
}
|
|
|
|
| 35 |
|
| 36 |
# Single prediction section
|
| 37 |
# if st.button("Predict", type='primary'):
|
|
@@ -50,7 +51,7 @@ if st.button("Predict"):
|
|
| 50 |
print(customer_data)
|
| 51 |
response = requests.post(
|
| 52 |
"https://MainiSandeep1987-BackEndFlaskAPITelecomChurnPrediction.hf.space/v1/customer",
|
| 53 |
-
json=
|
| 54 |
) # Send data to Flask API
|
| 55 |
response.raise_for_status() # Raise an error if the request fails
|
| 56 |
result = response.json()
|
|
|
|
| 19 |
MonthlyCharges = st.number_input("Monthly Charges", min_value=0.0, value=50.0)
|
| 20 |
TotalCharges = st.number_input("Total Charges", min_value=0.0, value=600.0)
|
| 21 |
|
| 22 |
+
# Convert user input into a DataFrame
|
| 23 |
+
customer_data = pd.DataFrame([{
|
| 24 |
'SeniorCitizen': 1 if SeniorCitizen == "Yes" else 0,
|
| 25 |
'Partner':Partner,
|
| 26 |
'Dependents': Dependents,
|
|
|
|
| 31 |
'PaymentMethod': PaymentMethod,
|
| 32 |
'MonthlyCharges': MonthlyCharges,
|
| 33 |
'TotalCharges': TotalCharges
|
| 34 |
+
}])
|
| 35 |
+
|
| 36 |
|
| 37 |
# Single prediction section
|
| 38 |
# if st.button("Predict", type='primary'):
|
|
|
|
| 51 |
print(customer_data)
|
| 52 |
response = requests.post(
|
| 53 |
"https://MainiSandeep1987-BackEndFlaskAPITelecomChurnPrediction.hf.space/v1/customer",
|
| 54 |
+
json=customer_data.to_dict(orient='records')[0]
|
| 55 |
) # Send data to Flask API
|
| 56 |
response.raise_for_status() # Raise an error if the request fails
|
| 57 |
result = response.json()
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
pandas==2.2.2
|
| 2 |
requests==2.28.1
|
| 3 |
-
streamlit==1.43.2
|
|
|
|
| 1 |
pandas==2.2.2
|
| 2 |
requests==2.28.1
|
| 3 |
+
streamlit==1.43.2
|