singhina commited on
Commit
3bab0d1
·
1 Parent(s): e83af60

Frontend: clean clone + update Streamlit UI

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -2
  2. streamlit_app.py +46 -0
requirements.txt CHANGED
@@ -1,4 +1,3 @@
1
  streamlit==1.29.0
2
  pandas==2.1.1
3
- scikit-learn==1.6.1
4
- joblib==1.3.2
 
1
  streamlit==1.29.0
2
  pandas==2.1.1
3
+ requests==2.32.3
 
streamlit_app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import requests, os
4
+
5
+ st.set_page_config(page_title="SuperKart Forecast", layout="centered")
6
+ st.title("🛒 SuperKart Quarterly Sales Forecast")
7
+
8
+ BACKEND_URL = os.getenv(
9
+ "BACKEND_URL",
10
+ "https://huggingface.co/spaces/singhina/superkart-forecast"
11
+ )
12
+
13
+ c1, c2 = st.columns(2)
14
+ with c1:
15
+ pw = st.number_input("Product Weight", 0.0,100.0,12.5,0.1)
16
+ pa = st.number_input("Allocated Area Ratio", 0.0, 1.0,0.08,0.005)
17
+ mrp = st.number_input("Product MRP (₹)", 0.0,1000.0,50.0,1.0)
18
+ year= st.number_input("Store Established Year",1900,2025,2015,1)
19
+ size= st.selectbox("Store Size", ["low","medium","high"])
20
+ with c2:
21
+ city = st.selectbox("City Tier", ["Tier 1","Tier 2","Tier 3"])
22
+ stype= st.selectbox("Store Type", [
23
+ "Departmental Store","Supermarket Type 1",
24
+ "Supermarket Type 2","Food Mart"
25
+ ])
26
+ prefix=st.text_input("Product Prefix","FD")
27
+ pnum =st.number_input("Product Numeric ID", 0,100000,6114,1)
28
+ age =st.number_input("Store Age (yrs)", 0, 50, int(pd.Timestamp.now().year-year),1)
29
+
30
+ if st.button("🔮 Predict"):
31
+ payload={"data":[{
32
+ "Product_Weight":pw,
33
+ "Product_Allocated_Area":pa,
34
+ "Product_MRP":mrp,
35
+ "Store_Establishment_Year":year,
36
+ "Store_Size":size,
37
+ "Store_Location_City_Type":city,
38
+ "Store_Type":stype,
39
+ "Product_Prefix":prefix,
40
+ "Product_Num":pnum,
41
+ "Store_Age":age
42
+ }]}
43
+ r = requests.post(f"{BACKEND_URL}/predict", json=payload)
44
+ r.raise_for_status()
45
+ pred = r.json()["predictions"][0]
46
+ st.success(f"🚀 Forecasted Sales: ₹{pred:,.2f}")