Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
-
---
|
| 2 |
-
sdk: streamlit
|
| 3 |
title: SuperKartPredictionFrontend
|
|
|
|
| 4 |
colorFrom: indigo
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
title: SuperKartPredictionFrontend
|
| 2 |
+
emoji: 🏢
|
| 3 |
colorFrom: indigo
|
| 4 |
+
colorTo: purple
|
| 5 |
+
sdk: streamlit
|
| 6 |
+
sdk_version: streamlit==1.43.2 # Added the sdk_version field
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
app.py
CHANGED
|
@@ -1,3 +1,69 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
import requests as requests # Import requests library
|
| 5 |
+
|
| 6 |
+
st.write("✅ App started - top of script reached")
|
| 7 |
+
|
| 8 |
+
st.title("Frontend Test OK ✅")
|
| 9 |
+
'''
|
| 10 |
+
|
| 11 |
+
# Streamlit UI for Price Prediction
|
| 12 |
+
st.title("SuperKart Revenue Prediction App")
|
| 13 |
+
st.write("This tool predicts the Revenue for SuperKart store based on the details.")
|
| 14 |
+
|
| 15 |
+
st.subheader("Enter the input details:")
|
| 16 |
+
|
| 17 |
+
# Collect user input
|
| 18 |
+
product_weight = st.number_input("Product_Weight", min_value=4.0, max_value=22.0, value=10.0)
|
| 19 |
+
product_sugar_content = st.selectbox("Product_Sugar_Content", ["Low Sugar","Regular","No Sugar","reg"])
|
| 20 |
+
product_allocated_area = st.number_input("Product_Allocated_Area", min_value=0.0040000, max_value=0.298000, value=0.1)
|
| 21 |
+
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"])
|
| 22 |
+
product_mrp = st.number_input("Product_MRP", min_value=31.0, max_value=266.0, value=100.0)
|
| 23 |
+
store_id = st.selectbox("Store_Id", ["OUT004","OUT001","OUT003","OUT002"])
|
| 24 |
+
store_age = st.number_input("Store_Age", min_value=16, max_value=38, value=20)
|
| 25 |
+
store_size = st.selectbox("Store_Size", ["Medium","High","Small"])
|
| 26 |
+
store_location_city_type = st.selectbox("Store_Location_City_Type", ["Tier 2","Tier 1","Tier 3"])
|
| 27 |
+
store_type = st.selectbox("Store_Type", ["Supermarket Type2","Supermarket Type1","Departmental Store","Food Mart"])
|
| 28 |
+
|
| 29 |
+
# Convert user input into a DataFrame
|
| 30 |
+
input_data = pd.DataFrame([{
|
| 31 |
+
'product_weight': product_weight,
|
| 32 |
+
'product_sugar_content': product_sugar_content,
|
| 33 |
+
'product_allocated_area': product_allocated_area,
|
| 34 |
+
'product_type': product_type,
|
| 35 |
+
'product_mrp': product_mrp,
|
| 36 |
+
'store_id': store_id,
|
| 37 |
+
'store_age': store_age,
|
| 38 |
+
'store_size': store_size,
|
| 39 |
+
'store_location_city_type': store_location_city_type,
|
| 40 |
+
'store_type': store_type
|
| 41 |
+
}])
|
| 42 |
+
|
| 43 |
+
st.write("✅ Before API call")
|
| 44 |
+
|
| 45 |
+
# Make prediction when the "Predict" button is clicked
|
| 46 |
+
if st.button("Predict"):
|
| 47 |
+
response = requests.post("https://data2aihub-SuperKartPredictionBackend.hf.space/v1/revenue", json=input_data.to_dict(orient='records')[0]) # Send data to Flask API
|
| 48 |
+
if response.status_code == 200:
|
| 49 |
+
prediction = response.json()['Predicted Price (in dollars)']
|
| 50 |
+
st.success(f"Predicted Rental Price (in dollars): {prediction}")
|
| 51 |
+
else:
|
| 52 |
+
st.error("Error making prediction.")
|
| 53 |
+
|
| 54 |
+
title: SuperKartPredictionFrontend
|
| 55 |
+
emoji: 🏢
|
| 56 |
+
colorFrom: indigo
|
| 57 |
+
colorTo: purple
|
| 58 |
+
sdk: streamlit
|
| 59 |
+
app_file: app.py
|
| 60 |
+
pinned: false
|
| 61 |
+
|
| 62 |
+
title: SuperKartPredictionFrontend
|
| 63 |
+
emoji: 🏢
|
| 64 |
+
colorFrom: indigo
|
| 65 |
+
colorTo: purple
|
| 66 |
+
sdk: streamlit
|
| 67 |
+
app_file: app.py
|
| 68 |
+
pinned: false
|
| 69 |
+
|