Spaces:
Sleeping
Sleeping
Commit
·
e65d289
1
Parent(s):
0e7425f
feat: updated website
Browse files
app.py
CHANGED
@@ -114,15 +114,15 @@ def get_supplier_name_encoded(encoded_code):
|
|
114 |
encoded_code = int(encoded_code)
|
115 |
print(f"Encoded Code: {encoded_code}")
|
116 |
|
117 |
-
#
|
118 |
-
if encoded_code
|
119 |
real_code = marca_id_mapping.inverse_transform([encoded_code])[0]
|
120 |
print(f"Real Manufacturer Code: {real_code}")
|
121 |
else:
|
122 |
print(f"Encoded code not found in the label encoder: {encoded_code}")
|
123 |
return f"Unknown code: {encoded_code}" # Handle case where encoded code is not found
|
124 |
-
|
125 |
-
# Now,
|
126 |
name = nombres_proveedores[nombres_proveedores['codigo'] == str(real_code)]['nombre'].values
|
127 |
print(f"Manufacturer Name Found: {name}") # Check what name is returned
|
128 |
|
|
|
114 |
encoded_code = int(encoded_code)
|
115 |
print(f"Encoded Code: {encoded_code}")
|
116 |
|
117 |
+
# Use the label encoder to map the encoded code back to the original manufacturer code
|
118 |
+
if encoded_code < len(marca_id_mapping.classes_):
|
119 |
real_code = marca_id_mapping.inverse_transform([encoded_code])[0]
|
120 |
print(f"Real Manufacturer Code: {real_code}")
|
121 |
else:
|
122 |
print(f"Encoded code not found in the label encoder: {encoded_code}")
|
123 |
return f"Unknown code: {encoded_code}" # Handle case where encoded code is not found
|
124 |
+
|
125 |
+
# Now, use the real_code to find the manufacturer name in nombres_proveedores
|
126 |
name = nombres_proveedores[nombres_proveedores['codigo'] == str(real_code)]['nombre'].values
|
127 |
print(f"Manufacturer Name Found: {name}") # Check what name is returned
|
128 |
|