Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ input_data = pd.DataFrame({
|
|
| 39 |
|
| 40 |
# Make prediction when the "Predict" button is clicked
|
| 41 |
if st.button("Predict"):
|
| 42 |
-
response = requests.post("https://
|
| 43 |
if response.status_code == 200:
|
| 44 |
prediction = response.json()['Predicted Sales (in dollars)']
|
| 45 |
st.success(f"Predicted Sales (in dollars): {prediction}")
|
|
@@ -55,7 +55,7 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 55 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 56 |
if uploaded_file is not None:
|
| 57 |
if st.button("Predict Batch"):
|
| 58 |
-
response = requests.post("https://
|
| 59 |
if response.status_code == 200:
|
| 60 |
predictions = response.json()
|
| 61 |
st.success("Batch predictions completed!")
|
|
|
|
| 39 |
|
| 40 |
# Make prediction when the "Predict" button is clicked
|
| 41 |
if st.button("Predict"):
|
| 42 |
+
response = requests.post("https://MBG0903-SuperKartSalesPredictionBackend.hf.space/v1/predict", json=input_data.to_dict(orient="records")[0])
|
| 43 |
if response.status_code == 200:
|
| 44 |
prediction = response.json()['Predicted Sales (in dollars)']
|
| 45 |
st.success(f"Predicted Sales (in dollars): {prediction}")
|
|
|
|
| 55 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 56 |
if uploaded_file is not None:
|
| 57 |
if st.button("Predict Batch"):
|
| 58 |
+
response = requests.post("https://MBG0903-SuperKartSalesPredictionBackend.hf.space/v1/predict/batch", files={"file": uploaded_file})
|
| 59 |
if response.status_code == 200:
|
| 60 |
predictions = response.json()
|
| 61 |
st.success("Batch predictions completed!")
|