File size: 1,475 Bytes
4059855 acadbb0 c70dff3 2c9bad4 c70dff3 acadbb0 4059855 c70dff3 4059855 2c9bad4 c70dff3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import streamlit as st
import requests
st.title("SuperKart Sales Prediction")
# Inputs
product_weight = st.number_input("Product Weight")
product_sugar = st.selectbox("Sugar Content", ["Low Sugar", "Regular"])
product_area = st.number_input("Allocated Area")
product_type = st.text_input("Product Type")
product_mrp = st.number_input("MRP")
store_year = st.number_input("Store Year")
store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
store_city = st.selectbox("City Type", ["Tier 1", "Tier 2", "Tier 3"])
store_type = st.text_input("Store Type")
product_category = st.text_input("Product Category")
product_id_char = st.text_input("Product ID Char")
if st.button("Predict"):
url = "https://muleex12-backends.hf.space/predict"
data = {
"Product_Weight": product_weight,
"Product_Sugar_Content": product_sugar,
"Product_Allocated_Area": product_area,
"Product_Type": product_type,
"Product_MRP": product_mrp,
"Store_Establishment_Year": store_year,
"Store_Size": store_size,
"Store_Location_City_Type": store_city,
"Store_Type": store_type,
"Product_Type_Category": product_category,
"Product_Id_char": product_id_char
}
response = requests.post(url, json=data)
if response.status_code == 200:
result = response.json()
st.success(f"Predicted Sales: {result['prediction']}")
else:
st.error("Error getting prediction") |