Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -49,8 +49,9 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 49 |
|
| 50 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 51 |
if uploaded_file is not None:
|
| 52 |
-
|
| 53 |
-
|
|
|
|
| 54 |
if response.status_code == 200:
|
| 55 |
predictions = response.json()
|
| 56 |
st.success("Batch predictions completed!")
|
|
@@ -58,3 +59,4 @@ if uploaded_file is not None:
|
|
| 58 |
else:
|
| 59 |
st.error("Error making batch prediction.")
|
| 60 |
st.error(f"Error code: {response.status_code}")
|
|
|
|
|
|
| 49 |
|
| 50 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 51 |
if uploaded_file is not None:
|
| 52 |
+
if st.button("Predict Batch"):
|
| 53 |
+
files = {"file": (uploaded_file.name, uploaded_file.getvalue(), "text\csv")}
|
| 54 |
+
response = requests.post("https://deepacsr-RentalPricePredictionBackend.hf.space/v1/ProductBatchSales",files=files) # Send file to Flask API
|
| 55 |
if response.status_code == 200:
|
| 56 |
predictions = response.json()
|
| 57 |
st.success("Batch predictions completed!")
|
|
|
|
| 59 |
else:
|
| 60 |
st.error("Error making batch prediction.")
|
| 61 |
st.error(f"Error code: {response.status_code}")
|
| 62 |
+
st.error(response.text)
|