Spaces:
Paused
Paused
handling double webhooks
Browse files
model.py
CHANGED
|
@@ -194,8 +194,16 @@ class T5Model(LabelStudioMLBase):
|
|
| 194 |
|
| 195 |
try:
|
| 196 |
# Extract text and label
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
# Configure LoRA
|
| 201 |
lora_config = LoraConfig(
|
|
|
|
| 194 |
|
| 195 |
try:
|
| 196 |
# Extract text and label
|
| 197 |
+
# LS sends two webhooks when training is initiated:
|
| 198 |
+
# 1. contains all project data
|
| 199 |
+
# 2. contains only the task data
|
| 200 |
+
# We need to check which one is present and use the appropriate data
|
| 201 |
+
if 'task' in data:
|
| 202 |
+
text = data['task']['data']['text']
|
| 203 |
+
label = data['annotation']['result'][0]['value']['choices'][0]
|
| 204 |
+
else:
|
| 205 |
+
logger.info("Skipping initial project setup webhook")
|
| 206 |
+
return
|
| 207 |
|
| 208 |
# Configure LoRA
|
| 209 |
lora_config = LoraConfig(
|