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