Spaces:
Runtime error
Runtime error
Download app.py from Debashre2824/SuperKart_Model_Deployment_Project: direct link, hf CLI and curl.
- Browser
- Download file 2.17 kB
-
https://huggingface.co/spaces/Debashre2824/SuperKart_Model_Deployment_Project/resolve/main/app.py
- Command line
-
hf download hf://spaces/Debashre2824/SuperKart_Model_Deployment_Project/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Debashre2824/SuperKart_Model_Deployment_Project/resolve/main/app.py
2.17 kB
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| # Load trained model pipeline | |
| model = joblib.load('SuperKart_Mode_v1_0.joblib') | |
| # Streamlit app title | |
| st.title("🛒 Product Store Sales Prediction App") | |
| st.markdown("Enter product and store details below to predict sales.") | |
| # Input form | |
| with st.form("prediction_form"): | |
| product_weight = st.number_input("Product Weight (in kg)", min_value=1.0, max_value=50.0, value=13.5) | |
| product_allocated_area = st.number_input("Allocated Area (0 to 1)", min_value=0.001, max_value=1.0, value=0.08) | |
| product_mrp = st.number_input("Product MRP (₹)", min_value=1.0, max_value=1000.0, value=250.75) | |
| store_age = st.number_input("Store Age (in years)", min_value=1, max_value=100, value=20) | |
| product_sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar", "High Sugar"]) | |
| product_type = st.selectbox("Product Type", [ | |
| "Meat", "Snack Foods", "Hard Drinks", "Dairy", "Canned", "Soft Drinks", | |
| "Health and Hygiene", "Baking Goods", "Bread", "Breakfast", "Frozen Foods", | |
| "Fruits and Vegetables", "Household", "Seafood", "Starchy Foods", "Others" | |
| ]) | |
| store_size = st.selectbox("Store Size", ["Small", "Medium", "High"]) | |
| store_location = st.selectbox("City Tier", ["Tier 1", "Tier 2", "Tier 3"]) | |
| store_type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type1", "Supermarket Type2", "Food Mart"]) | |
| submit = st.form_submit_button("Predict Sales") | |
| # Prediction logic | |
| if submit: | |
| input_dict = { | |
| "Product_Weight": [product_weight], | |
| "Product_Allocated_Area": [product_allocated_area], | |
| "Product_MRP": [product_mrp], | |
| "Store_Age": [store_age], | |
| "Product_Sugar_Content": [product_sugar_content], | |
| "Product_Type": [product_type], | |
| "Store_Size": [store_size], | |
| "Store_Location_City_Type": [store_location], | |
| "Store_Type": [store_type] | |
| } | |
| input_df = pd.DataFrame(input_dict) | |
| # Predict using loaded model | |
| prediction = model.predict(input_df)[0] | |
| # Show result | |
| st.success(f"📈 Predicted Product Store Sales: ₹{prediction:,.2f}") | |