Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -47,9 +47,26 @@ if st.button("Predict", type='primary'):
|
|
| 47 |
st.subheader("Batch Prediction")
|
| 48 |
|
| 49 |
file = st.file_uploader("Upload CSV file", type=["csv"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
if file is not None:
|
| 51 |
if st.button("Predict for Batch", type='primary'):
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
if response.status_code == 200:
|
| 54 |
result = response.json()
|
| 55 |
st.header("Batch Prediction Results")
|
|
|
|
| 47 |
st.subheader("Batch Prediction")
|
| 48 |
|
| 49 |
file = st.file_uploader("Upload CSV file", type=["csv"])
|
| 50 |
+
|
| 51 |
+
# batch_input = {
|
| 52 |
+
# 'file': batch_churn_dataset.to_csv(header=True, index=False).encode('utf-8')
|
| 53 |
+
# }
|
| 54 |
+
|
| 55 |
if file is not None:
|
| 56 |
if st.button("Predict for Batch", type='primary'):
|
| 57 |
+
headers = {
|
| 58 |
+
# "Authorization": "Bearer YOUR_API_KEY", # Replace with actual API key if needed
|
| 59 |
+
"Content-Type": "multipart/form-data"
|
| 60 |
+
}
|
| 61 |
+
file_data = {"file": ("batch.csv", file.getvalue(), "text/csv")} # Properly format file
|
| 62 |
+
|
| 63 |
+
response = requests.post(
|
| 64 |
+
"https://MainiSandeep1987-BackEndFlaskAPITelecomChurnPrediction.hf.space/v1/customerbatch",
|
| 65 |
+
files=file_data,
|
| 66 |
+
headers=headers
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
##response = requests.post("https://MainiSandeep1987-BackEndFlaskAPITelecomChurnPrediction.hf.space/v1/customerbatch", files={"file": file.getvalue()}) # enter user name and space name before running the cell
|
| 70 |
if response.status_code == 200:
|
| 71 |
result = response.json()
|
| 72 |
st.header("Batch Prediction Results")
|