molinari135 commited on
Commit
e0af3d8
·
verified ·
1 Parent(s): 199199d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -84,13 +84,18 @@ def predict_return(selected_products, total_customer_purchases, total_customer_r
84
  except requests.exceptions.RequestException as e:
85
  return f"Error: {str(e)}"
86
 
87
- # Gradio interface elements
 
 
 
 
 
 
88
  interface = gr.Interface(
89
  fn=predict_return, # Funzione per la logica di predizione
90
  inputs=[
91
  gr.CheckboxGroup(
92
- choices=[f"{row['Item Brand Model']}-{row['Item Brand Fabric']}-{row['Item Brand Colour']} {row['Net Sales (FA)']}"
93
- for _, row in inventory.iterrows()],
94
  label="Select Products"
95
  ),
96
  gr.Slider(0, 10, step=1, label="Total Customer Purchases", value=0),
@@ -104,4 +109,4 @@ interface = gr.Interface(
104
  )
105
 
106
  # Lancio dell'interfaccia Gradio
107
- interface.launch()
 
84
  except requests.exceptions.RequestException as e:
85
  return f"Error: {str(e)}"
86
 
87
+ # Crea l'interfaccia Gradio con le checkbox a sinistra
88
+ checkbox_choices = [
89
+ f"{row['Item Brand Model']}-{row['Item Brand Fabric']}-{row['Item Brand Colour']} - "
90
+ f"Type: {row['Product Type']} - Material: {row['Main Material']} - Sales: {row['Net Sales (FA)']} USD"
91
+ for _, row in inventory.iterrows()
92
+ ]
93
+
94
  interface = gr.Interface(
95
  fn=predict_return, # Funzione per la logica di predizione
96
  inputs=[
97
  gr.CheckboxGroup(
98
+ choices=checkbox_choices, # Mostra le informazioni dettagliate accanto ai codici
 
99
  label="Select Products"
100
  ),
101
  gr.Slider(0, 10, step=1, label="Total Customer Purchases", value=0),
 
109
  )
110
 
111
  # Lancio dell'interfaccia Gradio
112
+ interface.launch()