CodingBuddy commited on
Commit
ea8673e
·
verified ·
1 Parent(s): 712c255

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +12 -27
app.py CHANGED
@@ -8,21 +8,6 @@ st.title("SuperKart Sales Prediction")
8
  # Section for online prediction
9
  st.subheader("Sales Prediction")
10
 
11
- #Product_Weight = st.number_input("Product Weight", min_value=0.00, value=16.54)
12
- #Product_Sugar_Content = st.selectbox("Sugar Content", ["Low Sugar", "Regular", "No Sugar", "reg"], value="")
13
- #Product_Allocated_Area = st.number_input("Product Allocated area", value=0.144)
14
- #Product_Type = st.selectbox("Product Type", ['Frozen Foods', 'Dairy', 'Canned', 'Baking Goods',
15
- #'Health and Hygiene', 'Snack Foods', 'Meat', 'Household',
16
- #'Hard Drinks', 'Fruits and Vegetables', 'Breads', 'Soft Drinks',
17
- #'Breakfast', 'Others', 'Starchy Foods', 'Seafood'])
18
- #Product_MRP = st.number_input("Product MRP", 171.43)
19
- #Store_Id = st.selectbox("Select Store", ['OUT004', 'OUT003', 'OUT001', 'OUT002'])
20
- #Store_Establishment_Year = st.number_input("Store Establishment year", 1999)
21
- #Store_Size = st.selectbox("Select Store Size", ['Medium', 'High', 'Small'])
22
- #Store_Location_City_Type = st.selectbox("Select Store Location", ['Tier 2', 'Tier 1', 'Tier 3'])
23
- #Store_Type = st.selectbox("Store Type", ['Supermarket Type2', 'Departmental Store', 'Supermarket Type1',
24
- # 'Food Mart'])
25
-
26
  Product_Weight = st.number_input("Product Weight", min_value=0.01, value=16.54)
27
  Product_Sugar_Content = st.selectbox("Sugar Content", ["Low Sugar", "Regular", "No Sugar", "reg"], index=0)
28
  Product_Allocated_Area = st.number_input("Product Allocated area", value=0.144)
@@ -42,23 +27,23 @@ Store_Type = st.selectbox("Store Type", ['Supermarket Type2', 'Departmental Stor
42
 
43
  # Convert user input into a DataFrame
44
  input_data = pd.DataFrame([{
45
- Product_Weight : Product_Weight,
46
- Product_Sugar_Content : Product_Sugar_Content,
47
- Product_Allocated_Area : Product_Allocated_Area,
48
- Product_Type : Product_Type,
49
- Product_MRP : Product_MRP,
50
- Store_Id : Store_Id,
51
- Store_Establishment_Year : Store_Establishment_Year,
52
- Store_Size : Store_Size,
53
- Store_Location_City_Type : Store_Location_City_Type,
54
- Store_Type : Store_Type
55
  }])
56
 
57
  # Make prediction when the "Predict" button is clicked
58
  if st.button("Predict"):
59
  response = requests.post("https://codingbuddy-superkartbackendapi.hf.space/v1/sales", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
60
  if response.status_code == 200:
61
- prediction = response.json()['Predicted Price (in dollars)']
62
- st.success(f"Predicted Rental Price (in dollars): {prediction}")
63
  else:
64
  st.error("Error making prediction.")
 
8
  # Section for online prediction
9
  st.subheader("Sales Prediction")
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  Product_Weight = st.number_input("Product Weight", min_value=0.01, value=16.54)
12
  Product_Sugar_Content = st.selectbox("Sugar Content", ["Low Sugar", "Regular", "No Sugar", "reg"], index=0)
13
  Product_Allocated_Area = st.number_input("Product Allocated area", value=0.144)
 
27
 
28
  # Convert user input into a DataFrame
29
  input_data = pd.DataFrame([{
30
+ "Product_Weight" : Product_Weight,
31
+ "Product_Sugar_Content" : Product_Sugar_Content,
32
+ "Product_Allocated_Area" : Product_Allocated_Area,
33
+ "Product_Type" : Product_Type,
34
+ "Product_MRP" : Product_MRP,
35
+ "Store_Id" : Store_Id,
36
+ "Store_Establishment_Year" : Store_Establishment_Year,
37
+ "Store_Size" : Store_Size,
38
+ "Store_Location_City_Type" : Store_Location_City_Type,
39
+ "Store_Type" : Store_Type
40
  }])
41
 
42
  # Make prediction when the "Predict" button is clicked
43
  if st.button("Predict"):
44
  response = requests.post("https://codingbuddy-superkartbackendapi.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_Sale']
47
+ st.success(f"Predicted Sales: {prediction}")
48
  else:
49
  st.error("Error making prediction.")