Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -42,7 +42,7 @@ input_data = pd.DataFrame([{
|
|
| 42 |
|
| 43 |
# Make prediction when the "Predict" button is clicked
|
| 44 |
if st.button("Predict"):
|
| 45 |
-
response = requests.post("https://aiLearnerOnBudget-
|
| 46 |
if response.status_code == 200:
|
| 47 |
print(response)
|
| 48 |
prediction = response.json()['Predicted Product Store Sales']
|
|
@@ -59,7 +59,7 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 59 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 60 |
if uploaded_file is not None:
|
| 61 |
if st.button("Predict Batch"):
|
| 62 |
-
response = requests.post("https://aiLearnerOnBudget-
|
| 63 |
if response.status_code == 200:
|
| 64 |
predictions = response.json()
|
| 65 |
st.success("Batch predictions completed!")
|
|
|
|
| 42 |
|
| 43 |
# Make prediction when the "Predict" button is clicked
|
| 44 |
if st.button("Predict"):
|
| 45 |
+
response = requests.post("https://aiLearnerOnBudget-SuperkartSalesPredictionBackend.hf.space/v1/sales", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 46 |
if response.status_code == 200:
|
| 47 |
print(response)
|
| 48 |
prediction = response.json()['Predicted Product Store Sales']
|
|
|
|
| 59 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 60 |
if uploaded_file is not None:
|
| 61 |
if st.button("Predict Batch"):
|
| 62 |
+
response = requests.post("https://aiLearnerOnBudget-SuperkartSalesPredictionBackend.hf.space/v1/salesbatch", files={"file": uploaded_file}) # Send file to Flask API
|
| 63 |
if response.status_code == 200:
|
| 64 |
predictions = response.json()
|
| 65 |
st.success("Batch predictions completed!")
|