Upload folder using huggingface_hub
Browse files- app.py +42 -0
- requirements.txt +3 -3
app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import requests
|
| 4 |
+
|
| 5 |
+
# Set the title of the Streamlit app
|
| 6 |
+
st.title("SuperKart revenue Prediction")
|
| 7 |
+
|
| 8 |
+
# Section for online prediction
|
| 9 |
+
st.subheader("Predict Online!")
|
| 10 |
+
|
| 11 |
+
# Collect user input for property features
|
| 12 |
+
Product_Weight = st.number_input("Product_Weight", min_value=1, step=0.1)
|
| 13 |
+
Product_Allocated_Area = st.number_input("Product_Allocated_Area", min_value=1, step=0.1)
|
| 14 |
+
Store_Establishment_Year = st.number_input("Store_Establishment_Year", min_value=1900, step=1, max_value=2025)
|
| 15 |
+
Product_MRP = st.number_input("Product_MRP", min_value=0, step=0.1, value=0)
|
| 16 |
+
Product_Sugar_Content = st.selectbox("Product_Sugar_Content", ["Low Sugar", "Regular", "No Sugar"])
|
| 17 |
+
Product_Type = st.selectbox("Product_Type", ["Fruits and Vegetables", "Snack Foods","Frozen Foods","Dairy","Household","Baking Goods","Canned","Health and Hygiene","Meat","Soft Drinks","Breads","Hard Drinks","Others","Starchy Foods","Breakfast","Seafood"])
|
| 18 |
+
Store_Size = st.selectbox("Store_Size", ["Medium","High","Small"])
|
| 19 |
+
Store_Location_City_Type = st.selectbox("Store_Location_City_Type", ["Tier 1, Tier 2, Tier 3"])
|
| 20 |
+
Store_Type = st.selectbox("Store_Type",["Supermarket Type2","Supermarket Type1","Departmental Store","Food Mart"])
|
| 21 |
+
|
| 22 |
+
# Convert user input into a DataFrame
|
| 23 |
+
input_data = pd.DataFrame([{
|
| 24 |
+
'Product_Weight': Product_Weight,
|
| 25 |
+
'Product_Allocated_Area': Product_Allocated_Area,
|
| 26 |
+
'Store_Establishment_Year': Store_Establishment_Year,
|
| 27 |
+
'Product_MRP': Product_MRP,
|
| 28 |
+
'Product_Sugar_Content': Product_Sugar_Content,
|
| 29 |
+
'Product_Type': Product_Type,
|
| 30 |
+
'Store_Size': Store_Size,
|
| 31 |
+
'Store_Location_City_Type': Store_Location_City_Type,
|
| 32 |
+
'Store_Type': Store_Type
|
| 33 |
+
}])
|
| 34 |
+
|
| 35 |
+
# Make prediction when the "Predict" button is clicked
|
| 36 |
+
if st.button("Predict"):
|
| 37 |
+
response = requests.post("https://rishabhsinghjk-SuperKartRevenuePredictionBackend.hf.space/v1/revenue", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 38 |
+
if response.status_code == 200:
|
| 39 |
+
prediction = response.json()['Predicted revenue (in dollars)']
|
| 40 |
+
st.success(f"Predicted revenue (in dollars): {prediction}")
|
| 41 |
+
else:
|
| 42 |
+
st.error("Error making prediction.")
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
streamlit
|
|
|
|
| 1 |
+
pandas==2.2.2
|
| 2 |
+
requests==2.28.1
|
| 3 |
+
streamlit==1.43.2
|