Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -9,11 +9,11 @@ st.title("Superkart Price Prediction")
|
|
| 9 |
st.subheader("Online Prediction")
|
| 10 |
|
| 11 |
# Collect user input for property features
|
| 12 |
-
product_weight = st.number_input("Product Weight", min_value=0.0
|
| 13 |
product_sugar_content = st.selectbox("Product Sugar Content", ['Low Sugar', 'Regular', 'No Sugar'])
|
| 14 |
-
product_allocated_area = st.number_input("Product Allocated Area", min_value=0.0
|
| 15 |
product_type = st.selectbox("Product Type", ['Frozen Foods', 'Dairy', 'Canned', 'Baking Goods', 'Health and Hygiene', 'Snack Foods', 'Meat', 'Household', 'Hard Drinks', 'Fruits and Vegetables', 'Breads', 'Soft Drinks', 'Breakfast', 'Others', 'Starchy Foods', 'Seafood'])
|
| 16 |
-
product_mrp = st.number_input("Product MRP", min_value=0.0
|
| 17 |
store_size = st.selectbox("Store Size", ['Medium', 'High', 'Small'])
|
| 18 |
store_location_city_type = st.selectbox("Store Location City Type", ['Tier 2', 'Tier 1', 'Tier 3'])
|
| 19 |
age_category = st.selectbox("Age_Category", ['0to20', '21to30', '31to50'])
|
|
@@ -34,7 +34,7 @@ input_data = pd.DataFrame([{
|
|
| 34 |
|
| 35 |
# Make prediction when the "Predict" button is clicked
|
| 36 |
if st.button("Predict"):
|
| 37 |
-
response = requests.post("https://RedRooster99-
|
| 38 |
if response.status_code == 200:
|
| 39 |
prediction = response.json()['Predicted Price']
|
| 40 |
st.success(f"Superkart Price: {prediction}")
|
|
|
|
| 9 |
st.subheader("Online Prediction")
|
| 10 |
|
| 11 |
# Collect user input for property features
|
| 12 |
+
product_weight = st.number_input("Product Weight", min_value=0.0)
|
| 13 |
product_sugar_content = st.selectbox("Product Sugar Content", ['Low Sugar', 'Regular', 'No Sugar'])
|
| 14 |
+
product_allocated_area = st.number_input("Product Allocated Area", min_value=0.0)
|
| 15 |
product_type = st.selectbox("Product Type", ['Frozen Foods', 'Dairy', 'Canned', 'Baking Goods', 'Health and Hygiene', 'Snack Foods', 'Meat', 'Household', 'Hard Drinks', 'Fruits and Vegetables', 'Breads', 'Soft Drinks', 'Breakfast', 'Others', 'Starchy Foods', 'Seafood'])
|
| 16 |
+
product_mrp = st.number_input("Product MRP", min_value=0.0)
|
| 17 |
store_size = st.selectbox("Store Size", ['Medium', 'High', 'Small'])
|
| 18 |
store_location_city_type = st.selectbox("Store Location City Type", ['Tier 2', 'Tier 1', 'Tier 3'])
|
| 19 |
age_category = st.selectbox("Age_Category", ['0to20', '21to30', '31to50'])
|
|
|
|
| 34 |
|
| 35 |
# Make prediction when the "Predict" button is clicked
|
| 36 |
if st.button("Predict"):
|
| 37 |
+
response = requests.post("https://RedRooster99-projectbackend.hf.space/v1/superkart", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 38 |
if response.status_code == 200:
|
| 39 |
prediction = response.json()['Predicted Price']
|
| 40 |
st.success(f"Superkart Price: {prediction}")
|