TokenTutor commited on
Commit
47210b0
·
verified ·
1 Parent(s): fdcce80

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -93,4 +93,20 @@ if st.button("Predict"):
93
  else:
94
  st.write(f"Error making prediction: {response.status_code}")
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
 
93
  else:
94
  st.write(f"Error making prediction: {response.status_code}")
95
 
96
+ # Section for batch prediction
97
+ st.subheader("Batch Prediction")
98
+
99
+ # Allow users to upload a CSV file for batch prediction
100
+ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["csv"])
101
+ BATCH_ENDPOINT="https://TokenTutor-SuperKartSalesPrectionBackend.hf.space/v1/forecastbatch"
102
+ # Make batch prediction when the "Predict Batch" button is clicked
103
+ if uploaded_file is not None:
104
+ if st.button("Predict Batch"):
105
+ response = requests.post(BATCH_ENDPOINT, files={"file": uploaded_file}) # Send file to Flask API
106
+ if response.status_code == 200:
107
+ predictions = response.json()
108
+ st.success("Batch predictions completed!")
109
+ st.write(predictions) # Display the predictions
110
+ else:
111
+ st.error("Error making batch prediction.")
112