HacksterT commited on
Commit
249e52a
·
verified ·
1 Parent(s): e17014c

Upload app.py matching class template - 1754763945

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -18,21 +18,20 @@ Product_Type_Category = st.selectbox("Product Type Category", ["Dairy", "Soft Dr
18
  product_data = {
19
  "Product_Weight": Product_Weight,
20
  "Product_Sugar_Content": Product_Sugar_Content,
21
- "Product_Allocated_Area": Product_Allocated_Area,
22
  "Product_MRP": Product_MRP,
23
  "Store_Size": Store_Size,
24
  "Store_Location_City_Type": Store_Location_City_Type,
25
  "Store_Type": Store_Type,
26
- "Product_Id_char": Product_Id_char,
27
- "Store_Age_Years": Store_Age_Years,
28
- "Product_Type_Category": Product_Type_Category
29
  }
30
 
31
  if st.button("Predict", type='primary'):
32
  response = requests.post("https://hackstert-greatlearningproject.hf.space/predict", json=product_data)
33
  if response.status_code == 200:
34
  result = response.json()
35
- predicted_sales = result["Sales"]
36
- st.write(f"Predicted Product Store Sales Total: ₹{predicted_sales:.2f}")
37
  else:
38
- st.error("Error in API request")
 
18
  product_data = {
19
  "Product_Weight": Product_Weight,
20
  "Product_Sugar_Content": Product_Sugar_Content,
 
21
  "Product_MRP": Product_MRP,
22
  "Store_Size": Store_Size,
23
  "Store_Location_City_Type": Store_Location_City_Type,
24
  "Store_Type": Store_Type,
25
+ "Store_Establishment_Year": 2025 - Store_Age_Years, # Convert back to establishment year
26
+ "Product_Type": Product_Type_Category,
27
+ "Store_Id": Product_Id_char # Map to Store_Id
28
  }
29
 
30
  if st.button("Predict", type='primary'):
31
  response = requests.post("https://hackstert-greatlearningproject.hf.space/predict", json=product_data)
32
  if response.status_code == 200:
33
  result = response.json()
34
+ predicted_sales = result["prediction"]
35
+ st.write(f"Predicted Product Store Sales Total: ${predicted_sales:.2f}")
36
  else:
37
+ st.error(f"Error in API request: {response.text}")