Spaces:
Sleeping
Sleeping
feat: stop send message to so callled toeknizer_service_url
Browse files
app.py
CHANGED
@@ -1342,18 +1342,22 @@ def num_tokens_from_string(string, model=""):
|
|
1342 |
print(f"发送请求到tokenizer服务: {TOKENIZER_SERVICE_URL}")
|
1343 |
print(f"请求数据: {json.dumps(request_data, ensure_ascii=False)}")
|
1344 |
|
1345 |
-
response = requests.post(
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
-
)
|
1350 |
|
1351 |
-
print(f"\nTokenizer响应状态码: {response.status_code}")
|
1352 |
-
print(f"Tokenizer响应内容: {response.text}")
|
1353 |
|
1354 |
-
if response.status_code == 200:
|
1355 |
-
|
1356 |
-
|
|
|
|
|
|
|
|
|
1357 |
print(f"\n成功获取token数: {input_tokens}")
|
1358 |
print(f"使用计算方法: 精确")
|
1359 |
print("===================== 计算完成 =====================\n")
|
|
|
1342 |
print(f"发送请求到tokenizer服务: {TOKENIZER_SERVICE_URL}")
|
1343 |
print(f"请求数据: {json.dumps(request_data, ensure_ascii=False)}")
|
1344 |
|
1345 |
+
#response = requests.post(
|
1346 |
+
# TOKENIZER_SERVICE_URL,
|
1347 |
+
# json=request_data,
|
1348 |
+
# timeout=10
|
1349 |
+
#)
|
1350 |
|
1351 |
+
#print(f"\nTokenizer响应状态码: {response.status_code}")
|
1352 |
+
#print(f"Tokenizer响应内容: {response.text}")
|
1353 |
|
1354 |
+
# if response.status_code == 200:
|
1355 |
+
if False :
|
1356 |
+
# result = response.json()
|
1357 |
+
# input_tokens = result.get("input_tokens", 0)
|
1358 |
+
|
1359 |
+
input_tokens = 4000
|
1360 |
+
|
1361 |
print(f"\n成功获取token数: {input_tokens}")
|
1362 |
print(f"使用计算方法: 精确")
|
1363 |
print("===================== 计算完成 =====================\n")
|