限制文本分类的文本长度

This commit is contained in:
2024-10-17 15:13:41 +08:00
parent 25df420be8
commit 1a0caf30d0

View File

@@ -200,6 +200,8 @@ def clas_text(text):
if not text:
return None
url = 'http://clas_text:5008'
if len(text) > 2048:
text = text[:2048]
response = requests.post(url, {'text': text})
if response.status_code == 200:
return response.json()