Spaces:
Runtime error
Runtime error
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -104,11 +104,13 @@ st.title("🛍️ Advanced E-Commerce Price Predictor")
|
|
| 104 |
with st.container():
|
| 105 |
c1, c2 = st.columns([2, 1])
|
| 106 |
with c1:
|
| 107 |
-
p_name = st.text_input("Product Name", "
|
| 108 |
-
p_desc = st.text_area("
|
|
|
|
|
|
|
| 109 |
with c2:
|
| 110 |
categories_list = get_categories()
|
| 111 |
-
category = st.selectbox("Category", categories_list, index=categories_list.index('
|
| 112 |
shop_tier = st.selectbox(
|
| 113 |
"Shop Tier",
|
| 114 |
["Regular Merchant", "Power Merchant", "Official Store"]
|
|
@@ -120,12 +122,12 @@ c_left, c_right = st.columns(2)
|
|
| 120 |
with c_left:
|
| 121 |
with st.expander("📦 Physical, Stock & Shipping", expanded=True):
|
| 122 |
col1, col2, col3 = st.columns(3)
|
| 123 |
-
weight = col1.number_input("Weight (g)", value=
|
| 124 |
-
stock = col2.number_input("Stock", value=
|
| 125 |
-
sold = col3.number_input("Sold", value=
|
| 126 |
|
| 127 |
min_order = col1.number_input("Min Order", value=1)
|
| 128 |
-
max_order = col2.number_input("Max Order", value=
|
| 129 |
|
| 130 |
st.caption("Shipping Options")
|
| 131 |
sc1, sc2, sc3 = st.columns(3)
|
|
@@ -138,23 +140,23 @@ with c_left:
|
|
| 138 |
total_shipping = st.number_input("Total Shipping Types", value=2)
|
| 139 |
|
| 140 |
is_preorder = st.checkbox("Preorder?", False)
|
| 141 |
-
is_discount = st.checkbox("Discounted?",
|
| 142 |
|
| 143 |
with st.expander("🏪 Shop Performance", expanded=False):
|
| 144 |
shop_age = st.number_input("Shop Age (Days)", 365)
|
| 145 |
shop_pop = st.number_input("Shop Popularity Score", 100)
|
| 146 |
shop_city_pop = st.number_input("City Popularity", 1)
|
| 147 |
-
resp_time = st.number_input("Response Time (mins)",
|
| 148 |
-
date_shop_open = st.date_input("Shop Open Since",
|
| 149 |
|
| 150 |
with st.expander("⚙️ Advanced Shop Setup (Detailed Ratings)", expanded=False):
|
| 151 |
st.caption("Input exact review counts for the entire shop")
|
| 152 |
ac1, ac2, ac3, ac4, ac5 = st.columns(5)
|
| 153 |
-
shop_r5 = ac1.number_input("Shop 5★", value=
|
| 154 |
-
shop_r4 = ac2.number_input("Shop 4★", value=
|
| 155 |
-
shop_r3 = ac3.number_input("Shop 3★", value=
|
| 156 |
-
shop_r2 = ac4.number_input("Shop 2★", value=
|
| 157 |
-
shop_r1 = ac5.number_input("Shop 1★", value=
|
| 158 |
|
| 159 |
shop_total_rating = shop_r5 + shop_r4 + shop_r3 + shop_r2 + shop_r1
|
| 160 |
|
|
@@ -167,35 +169,35 @@ with c_left:
|
|
| 167 |
with c_right:
|
| 168 |
with st.expander("⭐ Product Ratings & Reviews", expanded=True):
|
| 169 |
c1, c2, c3, c4, c5 = st.columns(5)
|
| 170 |
-
r5 = c1.number_input("Prod 5★", value=
|
| 171 |
-
r4 = c2.number_input("Prod 4★", value=
|
| 172 |
-
r3 = c3.number_input("Prod 3★", value=
|
| 173 |
-
r2 = c4.number_input("Prod 2★", value=
|
| 174 |
-
r1 = c5.number_input("Prod 1★", value=
|
| 175 |
|
| 176 |
total_rating_count = r5 + r4 + r3 + r2 + r1
|
| 177 |
weighted_sum = (r5*5 + r4*4 + r3*3 + r2*2 + r1*1)
|
| 178 |
avg_rating = weighted_sum / total_rating_count if total_rating_count > 0 else 0.0
|
| 179 |
st.info(f"Avg Rating: {avg_rating:.2f} ({total_rating_count} ratings)")
|
| 180 |
|
| 181 |
-
total_reviews = st.number_input("Total Written Reviews", value=
|
| 182 |
-
reviews_w_img = st.number_input("Reviews w/ Images", value=
|
| 183 |
-
satisfaction = st.slider("Buyer Satisfaction %", 0, 100,
|
| 184 |
|
| 185 |
with st.expander("💬 Count Review Topics", expanded=False):
|
| 186 |
tc1, tc2 = st.columns(2)
|
| 187 |
-
rev_qual = tc1.number_input("Quality",
|
| 188 |
-
rev_srv = tc2.number_input("Service",
|
| 189 |
-
rev_pack = tc1.number_input("Packaging",
|
| 190 |
-
rev_price = tc2.number_input("Price",
|
| 191 |
-
rev_desc = tc1.number_input("Description",
|
| 192 |
-
rev_ship = tc2.number_input("Shipping",
|
| 193 |
|
| 194 |
with st.expander("📸 Media & Listing Date", expanded=False):
|
| 195 |
mc1, mc2 = st.columns(2)
|
| 196 |
vid_count = mc1.number_input("Videos", 1)
|
| 197 |
-
img_count = mc2.number_input("Images",
|
| 198 |
-
date_listing = st.date_input("Listing Created",
|
| 199 |
|
| 200 |
feat_created = get_date_features(date_listing, "created_at")
|
| 201 |
feat_shop = get_date_features(date_shop_open, "shop_open_since")
|
|
|
|
| 104 |
with st.container():
|
| 105 |
c1, c2 = st.columns([2, 1])
|
| 106 |
with c1:
|
| 107 |
+
p_name = st.text_input("Product Name", "Jam tangan Automatic SF PS3/03 CCO Orange Rubber NFC Aktif fullset")
|
| 108 |
+
p_desc = st.text_area("""
|
| 109 |
+
Description", "SF PS3/03 aka "CCO" Kaca : Crystal Diameter : 47mm Weight : 138gr Case : Stainless Bezel : Stainless Strap : Rubber Buckle : Tang Movement : Automatic Japan Miyota 82A7 Quality : Clone 1:1 Function : Hour, Minute, Second, 24hour Indicator, Automatic. Include box fullset & extra rubber strap. Note : Untuk mencegah hal hal yg tidak diinginkan, harap membuat VIDEO UNBOXING sebelum membuka paket utk membantu jika diperlukannya klaim kerusakan atau kekurangan barang. Terima kasih
|
| 110 |
+
""")
|
| 111 |
with c2:
|
| 112 |
categories_list = get_categories()
|
| 113 |
+
category = st.selectbox("Category", categories_list, index=categories_list.index('Fashion Pria'))
|
| 114 |
shop_tier = st.selectbox(
|
| 115 |
"Shop Tier",
|
| 116 |
["Regular Merchant", "Power Merchant", "Official Store"]
|
|
|
|
| 122 |
with c_left:
|
| 123 |
with st.expander("📦 Physical, Stock & Shipping", expanded=True):
|
| 124 |
col1, col2, col3 = st.columns(3)
|
| 125 |
+
weight = col1.number_input("Weight (g)", value=1000)
|
| 126 |
+
stock = col2.number_input("Stock", value=5)
|
| 127 |
+
sold = col3.number_input("Sold", value=0)
|
| 128 |
|
| 129 |
min_order = col1.number_input("Min Order", value=1)
|
| 130 |
+
max_order = col2.number_input("Max Order", value=5)
|
| 131 |
|
| 132 |
st.caption("Shipping Options")
|
| 133 |
sc1, sc2, sc3 = st.columns(3)
|
|
|
|
| 140 |
total_shipping = st.number_input("Total Shipping Types", value=2)
|
| 141 |
|
| 142 |
is_preorder = st.checkbox("Preorder?", False)
|
| 143 |
+
is_discount = st.checkbox("Discounted?", False)
|
| 144 |
|
| 145 |
with st.expander("🏪 Shop Performance", expanded=False):
|
| 146 |
shop_age = st.number_input("Shop Age (Days)", 365)
|
| 147 |
shop_pop = st.number_input("Shop Popularity Score", 100)
|
| 148 |
shop_city_pop = st.number_input("City Popularity", 1)
|
| 149 |
+
resp_time = st.number_input("Response Time (mins)", 420)
|
| 150 |
+
date_shop_open = st.date_input("Shop Open Since", pd.to_datetime('1662746294'))
|
| 151 |
|
| 152 |
with st.expander("⚙️ Advanced Shop Setup (Detailed Ratings)", expanded=False):
|
| 153 |
st.caption("Input exact review counts for the entire shop")
|
| 154 |
ac1, ac2, ac3, ac4, ac5 = st.columns(5)
|
| 155 |
+
shop_r5 = ac1.number_input("Shop 5★", value=31)
|
| 156 |
+
shop_r4 = ac2.number_input("Shop 4★", value=3)
|
| 157 |
+
shop_r3 = ac3.number_input("Shop 3★", value=0)
|
| 158 |
+
shop_r2 = ac4.number_input("Shop 2★", value=0)
|
| 159 |
+
shop_r1 = ac5.number_input("Shop 1★", value=0)
|
| 160 |
|
| 161 |
shop_total_rating = shop_r5 + shop_r4 + shop_r3 + shop_r2 + shop_r1
|
| 162 |
|
|
|
|
| 169 |
with c_right:
|
| 170 |
with st.expander("⭐ Product Ratings & Reviews", expanded=True):
|
| 171 |
c1, c2, c3, c4, c5 = st.columns(5)
|
| 172 |
+
r5 = c1.number_input("Prod 5★", value=0)
|
| 173 |
+
r4 = c2.number_input("Prod 4★", value=0)
|
| 174 |
+
r3 = c3.number_input("Prod 3★", value=0)
|
| 175 |
+
r2 = c4.number_input("Prod 2★", value=0)
|
| 176 |
+
r1 = c5.number_input("Prod 1★", value=0)
|
| 177 |
|
| 178 |
total_rating_count = r5 + r4 + r3 + r2 + r1
|
| 179 |
weighted_sum = (r5*5 + r4*4 + r3*3 + r2*2 + r1*1)
|
| 180 |
avg_rating = weighted_sum / total_rating_count if total_rating_count > 0 else 0.0
|
| 181 |
st.info(f"Avg Rating: {avg_rating:.2f} ({total_rating_count} ratings)")
|
| 182 |
|
| 183 |
+
total_reviews = st.number_input("Total Written Reviews", value=0)
|
| 184 |
+
reviews_w_img = st.number_input("Reviews w/ Images", value=0)
|
| 185 |
+
satisfaction = st.slider("Buyer Satisfaction %", 0, 100, 0)
|
| 186 |
|
| 187 |
with st.expander("💬 Count Review Topics", expanded=False):
|
| 188 |
tc1, tc2 = st.columns(2)
|
| 189 |
+
rev_qual = tc1.number_input("Quality", 0)
|
| 190 |
+
rev_srv = tc2.number_input("Service", 0)
|
| 191 |
+
rev_pack = tc1.number_input("Packaging", 0)
|
| 192 |
+
rev_price = tc2.number_input("Price", 0)
|
| 193 |
+
rev_desc = tc1.number_input("Description", 0)
|
| 194 |
+
rev_ship = tc2.number_input("Shipping", 0)
|
| 195 |
|
| 196 |
with st.expander("📸 Media & Listing Date", expanded=False):
|
| 197 |
mc1, mc2 = st.columns(2)
|
| 198 |
vid_count = mc1.number_input("Videos", 1)
|
| 199 |
+
img_count = mc2.number_input("Images", 4)
|
| 200 |
+
date_listing = st.date_input("Listing Created", pd.to_datetime('2024-09-10T00:29:59+07:00'))
|
| 201 |
|
| 202 |
feat_created = get_date_features(date_listing, "created_at")
|
| 203 |
feat_shop = get_date_features(date_shop_open, "shop_open_since")
|