Spaces:
Sleeping
Sleeping
debugging webhooks
Browse files
model.py
CHANGED
|
@@ -141,12 +141,21 @@ class BertClassifier(LabelStudioMLBase):
|
|
| 141 |
logger.info(f"Returning {len(predictions)} predictions")
|
| 142 |
return predictions
|
| 143 |
|
| 144 |
-
def fit(self,
|
| 145 |
"""Train the model on the labeled data."""
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
# Check if the event is one that should trigger training
|
| 149 |
-
if
|
| 150 |
try:
|
| 151 |
# Fetch the full annotation data if not included in the payload
|
| 152 |
task_id = data.get('task_id')
|
|
|
|
| 141 |
logger.info(f"Returning {len(predictions)} predictions")
|
| 142 |
return predictions
|
| 143 |
|
| 144 |
+
def fit(self, event_data, data=None, **kwargs):
|
| 145 |
"""Train the model on the labeled data."""
|
| 146 |
+
# Debug logging for all incoming data
|
| 147 |
+
logger.info("=== WEBHOOK DEBUG INFO ===")
|
| 148 |
+
logger.info(f"event_data type: {type(event_data)}")
|
| 149 |
+
logger.info(f"event_data content: {event_data}")
|
| 150 |
+
logger.info(f"data type: {type(data)}")
|
| 151 |
+
logger.info(f"data content: {data}")
|
| 152 |
+
logger.info(f"kwargs: {kwargs}")
|
| 153 |
+
logger.info("=== END WEBHOOK DEBUG INFO ===")
|
| 154 |
+
|
| 155 |
+
logger.info(f"Received event: {event_data}")
|
| 156 |
|
| 157 |
# Check if the event is one that should trigger training
|
| 158 |
+
if event_data in ['ANNOTATION_CREATED', 'ANNOTATION_UPDATED']:
|
| 159 |
try:
|
| 160 |
# Fetch the full annotation data if not included in the payload
|
| 161 |
task_id = data.get('task_id')
|