HacksterT commited on
Commit
d0f40a5
·
verified ·
1 Parent(s): 80ee286

Force upload new streamlit app - 1754763035

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +38 -0
src/streamlit_app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+
4
+ st.title("SuperKart Sales Forecasting")
5
+
6
+ # Input fields matching class template structure
7
+ Product_Weight = st.number_input("Product Weight", min_value=0.0, value=12.66)
8
+ Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
9
+ Product_Allocated_Area = st.number_input("Product Allocated Area", min_value=0.0, value=0.1)
10
+ Product_MRP = st.number_input("Product MRP", min_value=0.0, value=150.0)
11
+ Store_Size = st.selectbox("Store Size", ["Small", "Medium", "High"])
12
+ Store_Location_City_Type = st.selectbox("Store Location City Type", ["Tier 1", "Tier 2", "Tier 3"])
13
+ Store_Type = st.selectbox("Store Type", ["Supermarket Type1", "Supermarket Type2", "Supermarket Type3", "Grocery Store"])
14
+ Product_Id_char = st.selectbox("Product Id Char", ["F", "D", "N"])
15
+ Store_Age_Years = st.number_input("Store Age Years", min_value=0, value=16)
16
+ Product_Type_Category = st.selectbox("Product Type Category", ["Dairy", "Soft Drinks", "Meat", "Fruits and Vegetables", "Household", "Baking Goods", "Snack Foods", "Frozen Foods", "Breakfast", "Health and Hygiene", "Hard Drinks", "Canned", "Breads", "Starchy Foods", "Others", "Seafood"])
17
+
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/v1/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")