Update handler.py
Browse files- handler.py +4 -3
handler.py
CHANGED
|
@@ -18,8 +18,10 @@ class EndpointHandler():
|
|
| 18 |
input = data.get("inputs",data)
|
| 19 |
date = data.get("date", None)
|
| 20 |
|
|
|
|
|
|
|
| 21 |
# Realizar la inferencia
|
| 22 |
-
outputs = self.pipeline(
|
| 23 |
|
| 24 |
# Ajustar las etiquetas a 0 y 1
|
| 25 |
label_mapping = {"LABEL_0": 0, "LABEL_1": 1}
|
|
@@ -32,7 +34,6 @@ class EndpointHandler():
|
|
| 32 |
"clasiffication": str(label_mapping[result['label']]), # "clasiffication" como string
|
| 33 |
"label": label_names[label_mapping[result['label']]] # Mapeo de etiquetas a nombres
|
| 34 |
}
|
| 35 |
-
for result, text in zip(
|
| 36 |
]
|
| 37 |
-
|
| 38 |
return adjusted_results
|
|
|
|
| 18 |
input = data.get("inputs",data)
|
| 19 |
date = data.get("date", None)
|
| 20 |
|
| 21 |
+
# Textos para análisis
|
| 22 |
+
texts = [input]
|
| 23 |
# Realizar la inferencia
|
| 24 |
+
outputs = self.pipeline(texts)
|
| 25 |
|
| 26 |
# Ajustar las etiquetas a 0 y 1
|
| 27 |
label_mapping = {"LABEL_0": 0, "LABEL_1": 1}
|
|
|
|
| 34 |
"clasiffication": str(label_mapping[result['label']]), # "clasiffication" como string
|
| 35 |
"label": label_names[label_mapping[result['label']]] # Mapeo de etiquetas a nombres
|
| 36 |
}
|
| 37 |
+
for result, text in zip(outputs, texts)
|
| 38 |
]
|
|
|
|
| 39 |
return adjusted_results
|