限制文本分类的文本长度
This commit is contained in:
@@ -200,6 +200,8 @@ def clas_text(text):
|
|||||||
if not text:
|
if not text:
|
||||||
return None
|
return None
|
||||||
url = 'http://clas_text:5008'
|
url = 'http://clas_text:5008'
|
||||||
|
if len(text) > 2048:
|
||||||
|
text = text[:2048]
|
||||||
response = requests.post(url, {'text': text})
|
response = requests.post(url, {'text': text})
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user