From 9cd4f917cc4dfdc47e0e94ea16bd137ffa052007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Fri, 17 Nov 2023 01:12:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=205001=20=E7=9A=84=E5=90=91?= =?UTF-8?q?=E9=87=8F=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/main.go | 2 +- bin/resnet.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/main.go b/bin/main.go index 341e101..8c20814 100644 --- a/bin/main.go +++ b/bin/main.go @@ -114,7 +114,7 @@ func GetNetWorkEmbedding(id int) (embedding []float32) { host := viper.GetString("embedding.host") port := viper.GetInt("embedding.port") httpClient := &http.Client{} - request, err := http.NewRequest("PUT", fmt.Sprintf("http://%s:%d/reverse/%d", host, port, id), nil) + request, err := http.NewRequest("PUT", fmt.Sprintf("http://%s:%d/api/default/%d", host, port, id), nil) if err != nil { log.Println("请求失败:", err) return diff --git a/bin/resnet.py b/bin/resnet.py index b4cb3d3..35bbf7b 100644 --- a/bin/resnet.py +++ b/bin/resnet.py @@ -46,9 +46,6 @@ class ResNetServer(BaseHTTPRequestHandler): self.end_headers() # 完成服務器響應的標頭 content_length = int(self.headers['Content-Length']) # 獲取請求的內容長度 body = self.rfile.read(content_length) # 獲取請求的內容 - #img_path = './data/' + str(uuid.uuid4()) # 生成一個隨機的圖像文件名 - #with open(img_path, 'wb') as f: # 將二進制圖像文件解碼為圖像數據保存在本地 - # f.write(body) feat = towhee.blob(body).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')) # 將結果發送給客戶端