Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +5 -0
- app.py +39 -0
- requirements.txt +3 -0
Dockerfile
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9-slim
|
| 2 |
+
WORKDIR /app
|
| 3 |
+
COPY . .
|
| 4 |
+
RUN pip3 install -r requirements.txt
|
| 5 |
+
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
app.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import requests
|
| 4 |
+
|
| 5 |
+
st.title("SuperKart Sales Prediction App")
|
| 6 |
+
|
| 7 |
+
# Input fields for product and store data
|
| 8 |
+
Product_Weight = st.number_input("Product Weight", min_value=0.0, value=22.0)
|
| 9 |
+
Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
|
| 10 |
+
Product_Allocated_Area = st.number_input("Product_Allocated_Area", min_value=0.0, value=0.3)
|
| 11 |
+
Product_MRP = st.number_input("Product_MRP", min_value=0.0, value=12.66)
|
| 12 |
+
Store_Size = st.selectbox("Store_Size", ["Small", "Medium", "High"])
|
| 13 |
+
Store_Location_City_Type = st.selectbox("Store_Location_City_Type", ["Tier 1", "Tier 2", "Tier 3"])
|
| 14 |
+
Store_Type = st.selectbox("Store_Type", ["Supermarket Type2", "Departmental Store", "Supermarket Type1", "Food Mart"])
|
| 15 |
+
Product_Id_char = st.selectbox("Product_Id_char", ["FD", "NC", "DR"])
|
| 16 |
+
Store_Age_Years = st.number_input("Store_Age_Years", min_value=0, value=38)
|
| 17 |
+
Product_Type_Category = st.selectbox("Product_Type_Category", ["Perishables", "Non Perishables"])
|
| 18 |
+
|
| 19 |
+
product_data = {
|
| 20 |
+
"Product_Weight": Product_Weight,
|
| 21 |
+
"Product_Sugar_Content": Product_Sugar_Content,
|
| 22 |
+
"Product_Allocated_Area": Product_Allocated_Area,
|
| 23 |
+
"Product_MRP": Product_MRP,
|
| 24 |
+
"Store_Size": Store_Size,
|
| 25 |
+
"Store_Location_City_Type": Store_Location_City_Type,
|
| 26 |
+
"Store_Type": Store_Type,
|
| 27 |
+
"Product_Id_char": Product_Id_char,
|
| 28 |
+
"Store_Age_Years": Store_Age_Years,
|
| 29 |
+
"Product_Type_Category": Product_Type_Category
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if st.button("Predict", type='primary'):
|
| 33 |
+
response = requests.post("https://neham9009-SuperkartApi.hf.space/v1/predict", json=product_data)
|
| 34 |
+
if response.status_code == 200:
|
| 35 |
+
result = response.json()
|
| 36 |
+
predicted_sales = result["Sales"]
|
| 37 |
+
st.write(f"Predicted Product Store Sales Total: ${predicted_sales:.2f}")
|
| 38 |
+
else:
|
| 39 |
+
st.error("Error in API request")
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
requests==2.32.3
|
| 2 |
+
streamlit==1.45.0
|
| 3 |
+
pandas==2.2.2
|