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