molinari135 commited on
Commit
8c47187
·
verified ·
1 Parent(s): e0af3d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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(50)
14
 
15
  # Gradio Interface function
16
  def predict_return(selected_products, total_customer_purchases, total_customer_returns):
@@ -27,7 +27,12 @@ def predict_return(selected_products, total_customer_purchases, total_customer_r
27
 
28
  for selected_product in selected_products:
29
  # Split each selected product into model, fabric, and color
30
- model, fabric, color = selected_product.split("-")
 
 
 
 
 
31
  models.append(model)
32
  fabrics.append(fabric)
33
  colours.append(color)
 
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(20)
14
 
15
  # Gradio Interface function
16
  def predict_return(selected_products, total_customer_purchases, total_customer_returns):
 
27
 
28
  for selected_product in selected_products:
29
  # Split each selected product into model, fabric, and color
30
+ product_info = selected_product.split(" - ")
31
+ model_fabric_colour = product_info[0] # Questo è del tipo "Model-Fabric-Colour"
32
+
33
+ # Dividi il codice prodotto in modello, tessuto e colore
34
+ model, fabric, color = model_fabric_colour.split("-")
35
+
36
  models.append(model)
37
  fabrics.append(fabric)
38
  colours.append(color)