Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -11,9 +11,15 @@ st.subheader("Online Prediction")
|
|
| 11 |
# Collect user input for product details
|
| 12 |
product_type = st.selectbox("Product Type",["Frozen Foods","Dairy","Canned","Baking Goods","Snack Foods","Meat","Fruits and Vegetables","Breads","Breakfast","Starchy Foods","Seafood"])
|
| 13 |
product_sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar","Regular","No Sugar"])
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
store_size = st.selectbox("Store Size", ["Small","Medium","High"])
|
| 18 |
store_location_city_type = st.selectbox("Store Location City Type", ["Tier 1","Tier 2","Tier 3"])
|
| 19 |
store_type=st.selectbox("Store Type", ["Food Mart","Supermarket Type1","Supermarket Type2","Departmental Store"])
|
|
@@ -50,11 +56,8 @@ uploaded_file = st.file_uploader("Upload CSV file for batch prediction", type=["
|
|
| 50 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 51 |
if uploaded_file is not None:
|
| 52 |
if st.button("Predict Batch"):
|
| 53 |
-
#files = {"file": (uploaded_file.name, uploaded_file.getvalue(), "text/csv")}
|
| 54 |
st.write(uploaded_file.name)
|
| 55 |
st.write(uploaded_file.getvalue())
|
| 56 |
-
#files = {"file": (uploaded_file.name, uploaded_file.getvalue(), "csv")}
|
| 57 |
-
#response = requests.post("https://deepacsr-RentalPricePredictionBackend.hf.space/v1/ProductBatchSales",files=files) # Send file to Flask API
|
| 58 |
response = requests.post("https://deepacsr-ProductPricePredictionBackend.hf.space//v1/batchsales",files={"file": uploaded_file})
|
| 59 |
if response.status_code == 200:
|
| 60 |
predictions = response.json()
|
|
|
|
| 11 |
# Collect user input for product details
|
| 12 |
product_type = st.selectbox("Product Type",["Frozen Foods","Dairy","Canned","Baking Goods","Snack Foods","Meat","Fruits and Vegetables","Breads","Breakfast","Starchy Foods","Seafood"])
|
| 13 |
product_sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar","Regular","No Sugar"])
|
| 14 |
+
|
| 15 |
+
# Min, Max value taken from the statistics details captured in the EDA
|
| 16 |
+
# Mean value is taken as the default value
|
| 17 |
+
# Step is defined based on the range of numbers
|
| 18 |
+
|
| 19 |
+
product_mrp = st.number_input("MRP (in $)", min_value=31.0, max_value=267.0, step=1.0, value=147.0)
|
| 20 |
+
product_weight = st.number_input("Product Weight (in Ounce)", min_value=4.0, max_value=22, step=0.2, value=12.0)
|
| 21 |
+
product_allocated_area=st.number_input("Product Allocated area in %", min_value=0.4, max_value=30; step=0.1, value=0.7)
|
| 22 |
+
|
| 23 |
store_size = st.selectbox("Store Size", ["Small","Medium","High"])
|
| 24 |
store_location_city_type = st.selectbox("Store Location City Type", ["Tier 1","Tier 2","Tier 3"])
|
| 25 |
store_type=st.selectbox("Store Type", ["Food Mart","Supermarket Type1","Supermarket Type2","Departmental Store"])
|
|
|
|
| 56 |
# Make batch prediction when the "Predict Batch" button is clicked
|
| 57 |
if uploaded_file is not None:
|
| 58 |
if st.button("Predict Batch"):
|
|
|
|
| 59 |
st.write(uploaded_file.name)
|
| 60 |
st.write(uploaded_file.getvalue())
|
|
|
|
|
|
|
| 61 |
response = requests.post("https://deepacsr-ProductPricePredictionBackend.hf.space//v1/batchsales",files={"file": uploaded_file})
|
| 62 |
if response.status_code == 200:
|
| 63 |
predictions = response.json()
|