Download app.py from Muleex12/frrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/Muleex12/frrontend/resolve/main/app.py
- Command line
-
hf download hf://spaces/Muleex12/frrontend/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Muleex12/frrontend/resolve/main/app.py
1.48 kB
| import streamlit as st | |
| import requests | |
| st.title("SuperKart Sales Prediction") | |
| # Inputs | |
| product_weight = st.number_input("Product Weight") | |
| product_sugar = st.selectbox("Sugar Content", ["Low Sugar", "Regular"]) | |
| product_area = st.number_input("Allocated Area") | |
| product_type = st.text_input("Product Type") | |
| product_mrp = st.number_input("MRP") | |
| store_year = st.number_input("Store Year") | |
| store_size = st.selectbox("Store Size", ["Small", "Medium", "High"]) | |
| store_city = st.selectbox("City Type", ["Tier 1", "Tier 2", "Tier 3"]) | |
| store_type = st.text_input("Store Type") | |
| product_category = st.text_input("Product Category") | |
| product_id_char = st.text_input("Product ID Char") | |
| if st.button("Predict"): | |
| url = "https://muleex12-backends.hf.space/predict" | |
| data = { | |
| "Product_Weight": product_weight, | |
| "Product_Sugar_Content": product_sugar, | |
| "Product_Allocated_Area": product_area, | |
| "Product_Type": product_type, | |
| "Product_MRP": product_mrp, | |
| "Store_Establishment_Year": store_year, | |
| "Store_Size": store_size, | |
| "Store_Location_City_Type": store_city, | |
| "Store_Type": store_type, | |
| "Product_Type_Category": product_category, | |
| "Product_Id_char": product_id_char | |
| } | |
| response = requests.post(url, json=data) | |
| if response.status_code == 200: | |
| result = response.json() | |
| st.success(f"Predicted Sales: {result['prediction']}") | |
| else: | |
| st.error("Error getting prediction") |