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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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(20)
14
 
15
  # Gradio Interface function
16
  def predict_return(selected_products, total_customer_purchases, total_customer_returns):
@@ -51,7 +51,7 @@ def predict_return(selected_products, total_customer_purchases, total_customer_r
51
 
52
  # Add description to the cart
53
  description = (
54
- f"Model: {model}, Fabric: {fabric}, Colour: {color}\tSales Value: {product_value} USD"
55
  )
56
  descriptions.append(description)
57
  else:
@@ -79,7 +79,7 @@ def predict_return(selected_products, total_customer_purchases, total_customer_r
79
  return "Error: No predictions found."
80
 
81
  # Format the cart output
82
- cart_output = "\n".join(descriptions) + f"\nTotal Cart Value: {total_value} USD"
83
 
84
  # Format the prediction results
85
  formatted_result = "\n".join([f"Product: {pred['product']} \t Prediction: {pred['prediction']} \t Confidence: {pred['confidence']}%" for pred in predictions])
 
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(15)
14
 
15
  # Gradio Interface function
16
  def predict_return(selected_products, total_customer_purchases, total_customer_returns):
 
51
 
52
  # Add description to the cart
53
  description = (
54
+ f"Model: {model}, Fabric: {fabric}, Colour: {color} \tSales Value: {product_value} USD"
55
  )
56
  descriptions.append(description)
57
  else:
 
79
  return "Error: No predictions found."
80
 
81
  # Format the cart output
82
+ cart_output = "\n".join(descriptions) + f"\n\nTotal Cart Value: {total_value} USD"
83
 
84
  # Format the prediction results
85
  formatted_result = "\n".join([f"Product: {pred['product']} \t Prediction: {pred['prediction']} \t Confidence: {pred['confidence']}%" for pred in predictions])