Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +37 -0
- requirements.txt +6 -3
- superkart_prediction_model_v1_0.joblib +3 -0
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import joblib
|
| 5 |
+
import numpy as np
|
| 6 |
+
|
| 7 |
+
# Load the trained model
|
| 8 |
+
@st.cache_resource
|
| 9 |
+
def load_model():
|
| 10 |
+
return joblib.load("superkart_prediction_model_v1_0.joblib")
|
| 11 |
+
|
| 12 |
+
model = load_model()
|
| 13 |
+
|
| 14 |
+
# Streamlit UI for Price Prediction
|
| 15 |
+
st.title("superkart Prediction App")
|
| 16 |
+
st.write("This tool predicts the sale details.")
|
| 17 |
+
|
| 18 |
+
st.subheader("Enter the listing details:")
|
| 19 |
+
|
| 20 |
+
# Collect user input
|
| 21 |
+
product_type = st.selectbox("Product Type", ["Product_Type", "Snack Foods", "Meat","Dairy","Household","Baking Goods","Fruits and Vegetables","Canned"])
|
| 22 |
+
product_weight = st.number_input("Product Weight", min_value=10, value=10)
|
| 23 |
+
Product_MRP = st.number_input("Product MRP", min_value=1, value=2)
|
| 24 |
+
Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Product_Sugar_Content", "Low Sugar", "No Sugar","Regular"])
|
| 25 |
+
|
| 26 |
+
# Convert user input into a DataFrame
|
| 27 |
+
input_data = pd.DataFrame([{
|
| 28 |
+
'product_type': product_type,
|
| 29 |
+
'product_weight': product_weight,
|
| 30 |
+
'Product_MRP': Product_MRP,
|
| 31 |
+
'Product_Sugar_Content': Product_Sugar_Content
|
| 32 |
+
}])
|
| 33 |
+
|
| 34 |
+
# Predict button
|
| 35 |
+
if st.button("Predict"):
|
| 36 |
+
prediction = model.predict(input_data)
|
| 37 |
+
st.write(f"The predicted price of the sale is ${np.exp(prediction)[0]:.2f}.")
|
requirements.txt
CHANGED
|
@@ -1,3 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==2.2.2
|
| 2 |
+
numpy==2.0.2
|
| 3 |
+
scikit-learn==1.6.1
|
| 4 |
+
xgboost==2.1.4
|
| 5 |
+
joblib==1.4.2
|
| 6 |
+
streamlit==1.43.2
|
superkart_prediction_model_v1_0.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d39a3c6bd811719291d562ecbb395ae25c0b43ac56fe2ec61dea8ecb530e9620
|
| 3 |
+
size 208249
|