Spaces:
Sleeping
Sleeping
GMARTINEZMILLA
commited on
Commit
•
41da6c5
1
Parent(s):
963ac9e
feat: updated website
Browse files
app.py
CHANGED
@@ -108,18 +108,18 @@ def get_supplier_name(code):
|
|
108 |
name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
|
109 |
return name[0] if len(name) > 0 else code
|
110 |
|
111 |
-
def get_supplier_name_encoded(encoded_code):
|
112 |
-
encoded_code =
|
113 |
-
|
114 |
-
# First, use the label encoder to
|
115 |
if encoded_code in marca_id_mapping.classes_:
|
116 |
real_code = marca_id_mapping.inverse_transform([encoded_code])[0]
|
117 |
else:
|
118 |
return f"Unknown code: {encoded_code}" # Handle case where encoded code is not found
|
119 |
|
120 |
# Now, use the real_code to find the manufacturer name in nombres_proveedores
|
121 |
-
name = nombres_proveedores[nombres_proveedores['codigo'] == real_code]['nombre'].values
|
122 |
-
return name[0] if len(name) > 0 else real_code
|
123 |
|
124 |
# Custom Donut Chart with Plotly for Inbound/Outbound Percentage
|
125 |
def create_donut_chart(values, labels, color_scheme, title):
|
|
|
108 |
name = nombres_proveedores[nombres_proveedores['codigo'] == code]['nombre'].values
|
109 |
return name[0] if len(name) > 0 else code
|
110 |
|
111 |
+
def get_supplier_name_encoded(encoded_code):
|
112 |
+
encoded_code = int(encoded_code) # Ensure the encoded code is an integer
|
113 |
+
|
114 |
+
# First, try to use the label encoder to map the encoded code back to the original manufacturer code
|
115 |
if encoded_code in marca_id_mapping.classes_:
|
116 |
real_code = marca_id_mapping.inverse_transform([encoded_code])[0]
|
117 |
else:
|
118 |
return f"Unknown code: {encoded_code}" # Handle case where encoded code is not found
|
119 |
|
120 |
# Now, use the real_code to find the manufacturer name in nombres_proveedores
|
121 |
+
name = nombres_proveedores[nombres_proveedores['codigo'] == str(real_code)]['nombre'].values
|
122 |
+
return name[0] if len(name) > 0 else real_code
|
123 |
|
124 |
# Custom Donut Chart with Plotly for Inbound/Outbound Percentage
|
125 |
def create_donut_chart(values, labels, color_scheme, title):
|