Skip to content

Commit 4a43c3a

Browse files
committed
🐛 fix a bug in process_sequence_classification to ensure no 500 when populating detection field of ContentAnalysisResponse for HF models with no problem_type in their config
1 parent 72fd63a commit 4a43c3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

detectors/huggingface/detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def process_sequence_classification(self, text, detector_params=None, threshold=
253253
ContentAnalysisResponse(
254254
start=0,
255255
end=len(text),
256-
detection=getattr(self.model.config, "problem_type", "sequence_classification"),
256+
detection=getattr(self.model.config, "problem_type", None) or "sequence_classification",
257257
detection_type=label,
258258
score=prob,
259259
text=text,

0 commit comments

Comments
 (0)