Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ API_URL = "https://molinari135-product-return-prediction-api.hf.space/predict/"
|
|
10 |
# Load the inventory dataset from Hugging Face
|
11 |
hf_token = os.getenv("inventory_data")
|
12 |
dataset = load_dataset("molinari135/armani-inventory", token=hf_token, data_files="inventory.tsv")
|
13 |
-
inventory = pd.DataFrame(dataset['train']).head(
|
14 |
|
15 |
# Gradio Interface function
|
16 |
def predict_return(selected_products, total_customer_purchases, total_customer_returns):
|
@@ -47,6 +47,8 @@ def predict_return(selected_products, total_customer_purchases, total_customer_r
|
|
47 |
# Add description to the cart
|
48 |
description = (
|
49 |
f"Model: {model}, Fabric: {fabric}, Colour: {color}, "
|
|
|
|
|
50 |
f"Sales Value: {product_value} USD"
|
51 |
)
|
52 |
descriptions.append(description)
|
@@ -90,9 +92,8 @@ interface = gr.Interface(
|
|
90 |
fn=predict_return, # Funzione per la logica di predizione
|
91 |
inputs=[
|
92 |
gr.CheckboxGroup(
|
93 |
-
choices=[
|
94 |
-
|
95 |
-
for _, row in inventory.iterrows()],
|
96 |
label="Select Products"
|
97 |
),
|
98 |
gr.Slider(0, 10, step=1, label="Total Customer Purchases", value=0),
|
|
|
10 |
# Load the inventory dataset from Hugging Face
|
11 |
hf_token = os.getenv("inventory_data")
|
12 |
dataset = load_dataset("molinari135/armani-inventory", token=hf_token, data_files="inventory.tsv")
|
13 |
+
inventory = pd.DataFrame(dataset['train']).head(50)
|
14 |
|
15 |
# Gradio Interface function
|
16 |
def predict_return(selected_products, total_customer_purchases, total_customer_returns):
|
|
|
47 |
# Add description to the cart
|
48 |
description = (
|
49 |
f"Model: {model}, Fabric: {fabric}, Colour: {color}, "
|
50 |
+
f"Product Type: {product_details['Product Type'].values[0]}, "
|
51 |
+
f"Material: {product_details['Main Material'].values[0]}, "
|
52 |
f"Sales Value: {product_value} USD"
|
53 |
)
|
54 |
descriptions.append(description)
|
|
|
92 |
fn=predict_return, # Funzione per la logica di predizione
|
93 |
inputs=[
|
94 |
gr.CheckboxGroup(
|
95 |
+
choices=[f"{row['Item Brand Model']}-{row['Item Brand Fabric']}-{row['Item Brand Colour']}"
|
96 |
+
for _, row in inventory.iterrows()],
|
|
|
97 |
label="Select Products"
|
98 |
),
|
99 |
gr.Slider(0, 10, step=1, label="Total Customer Purchases", value=0),
|