Spaces:
Paused
Paused
model.py
CHANGED
|
@@ -140,7 +140,17 @@ class T5Model(LabelStudioMLBase):
|
|
| 140 |
logger.info(f"Additional kwargs: {kwargs}")
|
| 141 |
|
| 142 |
predictions = []
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
|
| 145 |
try:
|
| 146 |
for task in tasks:
|
|
|
|
| 140 |
logger.info(f"Additional kwargs: {kwargs}")
|
| 141 |
|
| 142 |
predictions = []
|
| 143 |
+
# Get valid choices during initialization instead of from kwargs
|
| 144 |
+
valid_choices = []
|
| 145 |
+
try:
|
| 146 |
+
import xml.etree.ElementTree as ET
|
| 147 |
+
root = ET.fromstring(self.label_config)
|
| 148 |
+
choices = root.findall('.//Choice')
|
| 149 |
+
valid_choices = [choice.get('value') for choice in choices]
|
| 150 |
+
logger.info(f"Valid choices: {valid_choices}")
|
| 151 |
+
except Exception as e:
|
| 152 |
+
logger.error(f"Error parsing choices: {str(e)}")
|
| 153 |
+
valid_choices = ["no_category"] # fallback
|
| 154 |
|
| 155 |
try:
|
| 156 |
for task in tasks:
|