优化拼接查询

This commit is contained in:
2023-11-13 19:01:49 +08:00
parent e938c49fd5
commit 612e3cc4e6
3 changed files with 25 additions and 102 deletions

View File

@@ -1,5 +1,4 @@
import json
import uuid
import towhee
from http.server import BaseHTTPRequestHandler, HTTPServer
@@ -39,19 +38,6 @@ class ResNetServer(BaseHTTPRequestHandler):
</body>
</html>
''', 'utf-8'))
## 定義一個處理 POST 請求的方法
#def do_POST(self):
# self.send_response(200) # 設置服務器響應的狀態碼
# self.send_header('Content-type', 'application/json') # 設置服務器響應的標頭
# self.end_headers() # 完成服務器響應的標頭
# content_length = int(self.headers['Content-Length']) # 獲取請求的內容長度
# body = self.rfile.read(content_length) # 獲取請求的內容
# params = json.loads(body) # 將請求的內容解析為字典
# img_path = params['img_path'] # 獲取圖像的路徑
# feat = towhee.glob(img_path).image_decode().image_embedding.timm(model_name='resnet50').tensor_normalize().to_list()
# results = json.dumps(feat[0].tolist()) # 將結果轉換為JSON格式
# self.wfile.write(bytes(results, 'utf-8'))
# 定義一個處理 POST 請求的方法, 接收二進制圖像文件
def do_POST(self):