Anu159 commited on
Commit
040179a
·
verified ·
1 Parent(s): 6566a0a

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -28,11 +28,13 @@ Store_Type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type
28
 
29
  # Convert user input into a DataFrame
30
  input_data = pd.DataFrame([{
 
31
  'Product_Weight': Product_Weight,
32
  'Product_Sugar_Content': Product_Sugar_Content,
33
  'Product_Allocated_Area': Product_Allocated_Area,
34
  'Product_Type': Product_Type,
35
  'Product_MRP': Product_MRP,
 
36
  'Store_Establishment_Year': Store_Establishment_Year,
37
  'Store_Size': Store_Size,
38
  'Store_Location_City_Type': Store_Location_City_Type,
@@ -41,9 +43,9 @@ input_data = pd.DataFrame([{
41
 
42
  # Make prediction when the "Predict" button is clicked
43
  if st.button("Predict"):
44
- response = requests.post("https://Anu159-md2fe.hf.space/v1/sales", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
45
  if response.status_code == 200:
46
- prediction = response.json()['Predicted Price (in dollars)']
47
  st.success(f"Predicted Product Revenue (in dollars): {prediction}")
48
  else:
49
  st.error("Error making prediction.")
@@ -57,11 +59,10 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
57
  # Make batch prediction when the "Predict Batch" button is clicked
58
  if uploaded_file is not None:
59
  if st.button("Predict Batch"):
60
- response = requests.post("https://Anu159-md2fe.hf.space/v1/salesbatch", files={"file": uploaded_file}) # Send file to Flask API
61
  if response.status_code == 200:
62
  predictions = response.json()
63
  st.success("Batch predictions completed!")
64
  st.write(predictions) # Display the predictions
65
  else:
66
  st.error("Error making batch prediction.")
67
-
 
28
 
29
  # Convert user input into a DataFrame
30
  input_data = pd.DataFrame([{
31
+ 'Product_Id': Product_Id,
32
  'Product_Weight': Product_Weight,
33
  'Product_Sugar_Content': Product_Sugar_Content,
34
  'Product_Allocated_Area': Product_Allocated_Area,
35
  'Product_Type': Product_Type,
36
  'Product_MRP': Product_MRP,
37
+ 'Store_Id': Store_Id,
38
  'Store_Establishment_Year': Store_Establishment_Year,
39
  'Store_Size': Store_Size,
40
  'Store_Location_City_Type': Store_Location_City_Type,
 
43
 
44
  # Make prediction when the "Predict" button is clicked
45
  if st.button("Predict"):
46
+ response = requests.post("https://Anu159-SuperKartSalesForecastPredictionBackend.hf.space/v1/sales", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
47
  if response.status_code == 200:
48
+ prediction = response.json()['prediction'] # check what should be value here
49
  st.success(f"Predicted Product Revenue (in dollars): {prediction}")
50
  else:
51
  st.error("Error making prediction.")
 
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://Anu159-SuperKartSalesForecastPredictionBackend.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!")
66
  st.write(predictions) # Display the predictions
67
  else:
68
  st.error("Error making batch prediction.")