Jelajahi Sumber

optimize en md (#2127)

* optimize en md

* optimize description
zhang-prog 1 tahun lalu
induk
melakukan
70c3675238

+ 134 - 162
docs/pipeline_usage/tutorials/cv_pipelines/image_anomaly_detection_en.md

@@ -78,9 +78,9 @@ pipeline = create_pipeline(pipeline="anomaly_detection")
 
 output = pipeline.predict("uad_grid.png")
 for res in output:
-    res.print() 
-    res.save_to_img("./output/") 
-    res.save_to_json("./output/") 
+    res.print()
+    res.save_to_img("./output/")
+    res.save_to_json("./output/")
 ```
 
 The results obtained are the same as those from the command line approach.
@@ -143,51 +143,51 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
+    |Name|Type|Description|
     |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
+    |Name|Type|Description|
     |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    对图像进行异常检测。
+    Performs anomaly detection on images.
 
     `POST /anomaly-detection`
 
-    - 请求体的属性如下:
+    - Request body attributes:
 
-        |名称|类型|含义|是否必填|
+        |Name|Type|Description|Required|
         |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
+        |`image`|`string`|The URL of the image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
+        |Name|Type|Description|
         |-|-|-|
-        |`labelMap`|`array`|记录图像中每个像素的类别标签(按照行优先顺序排列)。其中`255`表示异常点,`0`表示非异常点。|
-        |`size`|`array`|图像形状。数组中元素依次为图像的高度和宽度。|
-        |`image`|`string`|异常检测结果图。图像为JPEG格式,使用Base64编码。|
+        |`labelMap`|`array`|Records the class label of each pixel in the image (arranged in row-major order), where `255` represents an anomaly point, and `0` represents a non-anomaly point.|
+        |`size`|`array`|Image shape. The elements in the array are the height and width of the image in order.|
+        |`image`|`string`|Anomaly detection result image. The image is in JPEG format and encoded in Base64.|
 
-        `result`示例如下:
+        Example of `result`:
 
         ```json
         {
@@ -208,43 +208,39 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/anomaly-detection" # 服务URL
+API_URL = "http://localhost:8080/anomaly-detection"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
     file.write(base64.b64decode(result["image"]))
 print(f"Output image saved at {output_image_path}")
-# result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -260,7 +256,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -277,9 +272,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/anomaly-detection", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -292,7 +285,6 @@ int main() {
             outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());
             outputImage.close();
             std::cout << "Output image saved at " << outPutImagePath << std::endl;
-            // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
         } else {
             std::cerr << "Unable to open file for writing: " << outPutImagePath << std::endl;
         }
@@ -304,12 +296,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -323,20 +315,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/anomaly-detection"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/anomaly-detection";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -345,7 +335,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -359,7 +348,6 @@ public class Main {
                     fos.write(imageBytes);
                 }
                 System.out.println("Output image saved at " + outputImagePath);
-                // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
             } else {
                 System.err.println("Request failed with code: " + response.code());
             }
@@ -367,98 +355,94 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/anomaly-detection"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Labelmap []map[string]interface{} `json:"labelMap"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	// result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
+    API_URL := "http://localhost:8080/anomaly-detection"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Labelmap []map[string]interface{} `json:"labelMap"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -478,18 +462,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -498,16 +479,15 @@ class Program
 
         File.WriteAllBytes(outputImagePath, outputImageBytes);
         Console.WriteLine($"Output image saved at {outputImagePath}");
-        // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -521,50 +501,44 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
       if (err) throw err;
       console.log(`Output image saved at ${outputImagePath}`);
     });
-    // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 })
 .catch((error) => {
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/anomaly-detection"; // 服务URL
+$API_URL = "http://localhost:8080/anomaly-detection";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -572,14 +546,12 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
-// result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>

+ 154 - 175
docs/pipeline_usage/tutorials/cv_pipelines/image_classification_en.md

@@ -604,7 +604,7 @@ Image classification is a technique that assigns images to predefined categories
     <td>100.1 M</td>
   </tr>
 
-  
+
 </table>
 
 **Note: The above accuracy metrics refer to Top-1 Accuracy on the [ImageNet-1k](https://www.image-net.org/index.php) validation set. ****All model GPU inference times are based on NVIDIA Tesla T4 machines, with precision type FP32. CPU inference speeds are based on Intel® Xeon® Gold 5117 CPU @ 2.00GHz, with 8 threads and precision type FP32.**
@@ -744,72 +744,72 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    对图像进行分类。
+    Classify images.
 
     `POST /image-classification`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
-        |`inferenceParams`|`object`|推理参数。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of an image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
+        |`inferenceParams`|`object`|Inference parameters.|No|
 
-        `inferenceParams`的属性如下:
+        The attributes of `inferenceParams` are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`topK`|`integer`|结果中将只保留得分最高的`topK`个类别。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`topK`|`integer`|Only the top `topK` categories with the highest scores will be retained in the results.|No|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`categories`|`array`|图像类别信息。|
-        |`image`|`string`|图像分类结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`categories`|`array`|Image category information.|
+        |`image`|`string`|The image classification result image. The image is in JPEG format and encoded using Base64.|
 
-        `categories`中的每个元素为一个`object`,具有如下属性:
+        Each element in `categories` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`id`|`integer`|类别ID。|
-        |`name`|`string`|类别名称。|
-        |`score`|`number`|类别得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`id`|`integer`|Category ID.|
+        |`name`|`string`|Category name.|
+        |`score`|`number`|Category score.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
           "categories": [
             {
               "id": 5,
-              "name": "兔子",
+              "name": "Rabbit",
               "score": 0.93
             }
           ],
@@ -820,30 +820,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/image-classification" # 服务URL
+API_URL = "http://localhost:8080/image-classification"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -852,11 +849,11 @@ print(f"Output image saved at {output_image_path}")
 print("\nCategories:")
 print(result["categories"])
 ```
-  
+
 </details>
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -872,7 +869,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -889,9 +885,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/image-classification", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -921,12 +915,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -940,20 +934,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/image-classification"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/image-classification";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -962,7 +954,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -983,102 +974,99 @@ public class Main {
         }
     }
 }
-``` 
-  
+```
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/image-classification"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Categories []map[string]interface{} `json:"categories"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nCategories:")
-	for _, category := range respData.Result.Categories {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/image-classification"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Categories []map[string]interface{} `json:"categories"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nCategories:")
+    for _, category := range respData.Result.Categories {
+        fmt.Println(category)
+    }
 }
-``` 
-  
+```
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -1098,18 +1086,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -1123,12 +1108,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -1142,20 +1127,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -1169,23 +1151,21 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/image-classification"; // 服务URL
+$API_URL = "http://localhost:8080/image-classification";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -1193,7 +1173,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -1201,7 +1180,7 @@ echo "\nCategories:\n";
 print_r($result["categories"]);
 ?>
 ```
-  
+
 </details>
 
 </details>
@@ -1244,4 +1223,4 @@ At this point, if you wish to switch the hardware to Ascend NPU, simply modify t
 ```bash
 paddlex --pipeline image_classification --input general_image_classification_001.jpg --device npu:0
 ```
-If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the [PaddleX Multi-Device Usage Guide](../../../other_devices_support/installation_other_devices_en.md).
+If you want to use the General Image Classification Pipeline on more types of hardware, please refer to the [PaddleX Multi-Device Usage Guide](../../../other_devices_support/installation_other_devices_en.md).

+ 153 - 174
docs/pipeline_usage/tutorials/cv_pipelines/image_multi_label_classification_en.md

@@ -150,72 +150,72 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed to `0`.|
+    |`errorMsg`|`string`|Error message. Fixed to `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    对图像进行分类。
+    Classify images.
 
     `POST /multilabel-image-classification`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
-        |`inferenceParams`|`object`|推理参数。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of the image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
+        |`inferenceParams`|`object`|Inference parameters.|No|
 
-        `inferenceParams`的属性如下:
+        The attributes of `inferenceParams` are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`topK`|`integer`|结果中将只保留得分最高的`topK`个类别。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`topK`|`integer`|Only the top `topK` categories with the highest scores will be retained in the result.|No|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`categories`|`array`|图像类别信息。|
-        |`image`|`string`|图像分类结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`categories`|`array`|Image category information.|
+        |`image`|`string`|Image classification result image. The image is in JPEG format and encoded in Base64.|
 
-        `categories`中的每个元素为一个`object`,具有如下属性:
+        Each element in `categories` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`id`|`integer`|类别ID。|
-        |`name`|`string`|类别名称。|
-        |`score`|`number`|类别得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`id`|`integer`|Category ID.|
+        |`name`|`string`|Category name.|
+        |`score`|`number`|Category score.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
           "categories": [
             {
               "id": 5,
-              "name": "兔子",
+              "name": "Rabbit",
               "score": 0.93
             }
           ],
@@ -226,30 +226,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/multilabel-image-classification" # 服务URL
+API_URL = "http://localhost:8080/multilabel-image-classification"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -258,11 +255,11 @@ print(f"Output image saved at {output_image_path}")
 print("\nCategories:")
 print(result["categories"])
 ```
-  
+
 </details>
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -278,7 +275,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -295,9 +291,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/multilabel-image-classification", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -327,12 +321,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -346,20 +340,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/multilabel-image-classification"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/multilabel-image-classification";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -368,7 +360,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -389,102 +380,99 @@ public class Main {
         }
     }
 }
-``` 
-  
+```
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/multilabel-image-classification"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Categories []map[string]interface{} `json:"categories"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nCategories:")
-	for _, category := range respData.Result.Categories {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/multilabel-image-classification"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Categories []map[string]interface{} `json:"categories"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nCategories:")
+    for _, category := range respData.Result.Categories {
+        fmt.Println(category)
+    }
 }
-``` 
-  
+```
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -504,18 +492,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -529,12 +514,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -548,20 +533,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -575,23 +557,21 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/multilabel-image-classification"; // 服务URL
+$API_URL = "http://localhost:8080/multilabel-image-classification";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -599,7 +579,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -607,7 +586,7 @@ echo "\nCategories:\n";
 print_r($result["categories"]);
 ?>
 ```
-  
+
 </details>
 </details>
 
@@ -650,4 +629,4 @@ At this point, if you wish to switch the hardware to Ascend NPU, simply modify t
 ```
 paddlex --pipeline multi_label_image_classification --input https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_image_classification_001.jpg --device npu:0
 ```
-If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../installation/installation_other_devices_en.md).
+If you want to use the General Image Multi-label Classification Pipeline on more diverse hardware, please refer to the [PaddleX Multi-device Usage Guide](../../../installation/installation_other_devices_en.md).

+ 150 - 171
docs/pipeline_usage/tutorials/cv_pipelines/instance_segmentation_en.md

@@ -172,66 +172,66 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    对图像进行实例分割。
+    Performs instance segmentation on an image.
 
     `POST /instance-segmentation`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of an image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`instances`|`array`|实例的位置、类别等信息。|
-        |`image`|`string`|实例分割结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`instances`|`array`|Information about the locations and categories of instances.|
+        |`image`|`string`|The result image of instance segmentation. The image is in JPEG format and encoded in Base64.|
 
-        `instances`中的每个元素为一个`object`,具有如下属性:
+        Each element in `instances` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`bbox`|`array`|实例位置。数组中元素依次为边界框左上角x坐标、左上角y坐标、右下角x坐标以及右下角y坐标。|
-        |`categoryId`|`integer`|实例类别ID。|
-        |`score`|`number`|实例得分。|
-        |`mask`|`object`|实例的分割掩膜。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`bbox`|`array`|The location of the instance. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively.|
+        |`categoryId`|`integer`|The ID of the instance category.|
+        |`score`|`number`|The score of the instance.|
+        |`mask`|`object`|The segmentation mask of the instance.|
 
-        `mask`的属性如下:
+        The attributes of `mask` are as follows:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`rleResult`|`str`|掩膜的游程编码结果。|
-        |`size`|`array`|掩膜的形状。数组中元素依次为掩膜的高度和宽度。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`rleResult`|`str`|The run-length encoding result of the mask.|
+        |`size`|`array`|The shape of the mask. The elements in the array are the height and width of the mask, respectively.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -261,30 +261,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/instance-segmentation" # 服务URL
+API_URL = "http://localhost:8080/instance-segmentation"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -293,12 +290,12 @@ print(f"Output image saved at {output_image_path}")
 print("\nInstances:")
 print(result["instances"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -314,7 +311,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -331,9 +327,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/instance-segmentation", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -363,12 +357,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -382,20 +376,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/instance-segmentation"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/instance-segmentation";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -404,7 +396,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -426,101 +417,98 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/instance-segmentation"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Instances []map[string]interface{} `json:"instances"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nInstances:")
-	for _, category := range respData.Result.Instances {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/instance-segmentation"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Instances []map[string]interface{} `json:"instances"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nInstances:")
+    for _, category := range respData.Result.Instances {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -540,18 +528,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -565,12 +550,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -584,20 +569,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -611,24 +593,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/instance-segmentation"; // 服务URL
+$API_URL = "http://localhost:8080/instance-segmentation";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -636,7 +616,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -645,7 +624,7 @@ print_r($result["instances"]);
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>

+ 144 - 165
docs/pipeline_usage/tutorials/cv_pipelines/object_detection_en.md

@@ -459,58 +459,58 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Fixed as `0`. |
+    | `errorMsg` | `string` | Error description. Fixed as `"Success"`. |
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Same as the response status code. |
+    | `errorMsg` | `string` | Error description. |
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    对图像进行目标检测。
+    Performs object detection on an image.
 
     `POST /object-detection`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        | `image` | `string` | The URL of an image file accessible by the service or the Base64 encoded result of the image file content. | Yes |
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`detectedObjects`|`array`|目标的位置、类别等信息。|
-        |`image`|`string`|目标检测结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `detectedObjects` | `array` | Information about the location and category of the detected objects. |
+        | `image` | `string` | The image of the object detection result. The image is in JPEG format and encoded in Base64. |
 
-        `detectedObjects`中的每个元素为一个`object`,具有如下属性:
+        Each element in `detectedObjects` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`bbox`|`array`|目标位置。数组中元素依次为边界框左上角x坐标、左上角y坐标、右下角x坐标以及右下角y坐标。|
-        |`categoryId`|`integer`|目标类别ID。|
-        |`score`|`number`|目标得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `bbox` | `array` | The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. |
+        | `categoryId` | `integer` | The ID of the object category. |
+        | `score` | `number` | The score of the object. |
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -543,30 +543,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/object-detection" # 服务URL
+API_URL = "http://localhost:8080/object-detection"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -575,12 +572,12 @@ print(f"Output image saved at {output_image_path}")
 print("\nDetectedobjects:")
 print(result["detectedObjects"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -596,7 +593,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -613,9 +609,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/object-detection", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -645,12 +639,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -664,20 +658,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/object-detection"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/object-detection";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -686,7 +678,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -708,101 +699,98 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/object-detection"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Detectedobjects []map[string]interface{} `json:"detectedObjects"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nDetectedobjects:")
-	for _, category := range respData.Result.Detectedobjects {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/object-detection"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Detectedobjects []map[string]interface{} `json:"detectedObjects"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nDetectedobjects:")
+    for _, category := range respData.Result.Detectedobjects {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -822,18 +810,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -847,12 +832,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -866,20 +851,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -893,24 +875,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/object-detection"; // 服务URL
+$API_URL = "http://localhost:8080/object-detection";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -918,7 +898,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -927,7 +906,7 @@ print_r($result["detectedObjects"]);
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>

+ 135 - 163
docs/pipeline_usage/tutorials/cv_pipelines/semantic_segmentation_en.md

@@ -178,51 +178,51 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error description. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error description.|
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    对图像进行语义分割。
+    Performs semantic segmentation on an image.
 
     `POST /semantic-segmentation`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of an image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`labelMap`|`array`|记录图像中每个像素的类别标签(按照行优先顺序排列)。|
-        |`size`|`array`|图像形状。数组中元素依次为图像的高度和宽度。|
-        |`image`|`string`|语义分割结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`labelMap`|`array`|Records the class label of each pixel in the image (arranged in row-major order).|
+        |`size`|`array`|Image shape. The elements in the array are the height and width of the image, respectively.|
+        |`image`|`string`|The semantic segmentation result image. The image is in JPEG format and encoded using Base64.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -243,43 +243,39 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/semantic-segmentation" # 服务URL
+API_URL = "http://localhost:8080/semantic-segmentation"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
     file.write(base64.b64decode(result["image"]))
 print(f"Output image saved at {output_image_path}")
-# result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -295,7 +291,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -312,9 +307,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/semantic-segmentation", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -327,7 +320,6 @@ int main() {
             outputImage.write(reinterpret_cast<char*>(decodedImage.data()), decodedImage.size());
             outputImage.close();
             std::cout << "Output image saved at " << outPutImagePath << std::endl;
-            // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
         } else {
             std::cerr << "Unable to open file for writing: " << outPutImagePath << std::endl;
         }
@@ -339,12 +331,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -358,20 +350,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/semantic-segmentation"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/semantic-segmentation";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -380,7 +370,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -394,7 +383,6 @@ public class Main {
                     fos.write(imageBytes);
                 }
                 System.out.println("Output image saved at " + outputImagePath);
-                // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
             } else {
                 System.err.println("Request failed with code: " + response.code());
             }
@@ -402,98 +390,94 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/semantic-segmentation"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Labelmap []map[string]interface{} `json:"labelMap"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	// result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
+    API_URL := "http://localhost:8080/semantic-segmentation"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Labelmap []map[string]interface{} `json:"labelMap"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -513,18 +497,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -533,16 +514,15 @@ class Program
 
         File.WriteAllBytes(outputImagePath, outputImageBytes);
         Console.WriteLine($"Output image saved at {outputImagePath}");
-        // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -556,50 +536,44 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
       if (err) throw err;
       console.log(`Output image saved at ${outputImagePath}`);
     });
-    // result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 })
 .catch((error) => {
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/semantic-segmentation"; // 服务URL
+$API_URL = "http://localhost:8080/semantic-segmentation";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -607,14 +581,12 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
-// result.labelMap 记录图像中每个像素的类别标签(按照行优先顺序排列)详见API参考文档
 ?>
 ```
-  
+
 </details>
 
 </details>

+ 144 - 165
docs/pipeline_usage/tutorials/cv_pipelines/small_object_detection_en.md

@@ -151,58 +151,58 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 Below are the API references and multi-language service invocation examples:
 
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Fixed as `0`. |
+    | `errorMsg` | `string` | Error description. Fixed as `"Success"`. |
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Same as the response status code. |
+    | `errorMsg` | `string` | Error description. |
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    对图像进行目标检测。
+    Performs object detection on an image.
 
     `POST /object-detection`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        | `image` | `string` | The URL of an image file accessible by the service or the Base64 encoded result of the image file content. | Yes |
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`detectedObjects`|`array`|目标的位置、类别等信息。|
-        |`image`|`string`|目标检测结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `detectedObjects` | `array` | Information about the location and category of the detected objects. |
+        | `image` | `string` | The image of the object detection result. The image is in JPEG format and encoded in Base64. |
 
-        `detectedObjects`中的每个元素为一个`object`,具有如下属性:
+        Each element in `detectedObjects` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`bbox`|`array`|目标位置。数组中元素依次为边界框左上角x坐标、左上角y坐标、右下角x坐标以及右下角y坐标。|
-        |`categoryId`|`integer`|目标类别ID。|
-        |`score`|`number`|目标得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `bbox` | `array` | The location of the object. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively. |
+        | `categoryId` | `integer` | The ID of the object category. |
+        | `score` | `number` | The score of the object. |
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -235,30 +235,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/object-detection" # 服务URL
+API_URL = "http://localhost:8080/object-detection"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -267,12 +264,12 @@ print(f"Output image saved at {output_image_path}")
 print("\nDetectedobjects:")
 print(result["detectedObjects"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -288,7 +285,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -305,9 +301,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/object-detection", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -337,12 +331,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -356,20 +350,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/object-detection"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/object-detection";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -378,7 +370,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -400,101 +391,98 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/object-detection"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Detectedobjects []map[string]interface{} `json:"detectedObjects"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nDetectedobjects:")
-	for _, category := range respData.Result.Detectedobjects {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/object-detection"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Detectedobjects []map[string]interface{} `json:"detectedObjects"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nDetectedobjects:")
+    for _, category := range respData.Result.Detectedobjects {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -514,18 +502,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -539,12 +524,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -558,20 +543,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -585,24 +567,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/object-detection"; // 服务URL
+$API_URL = "http://localhost:8080/object-detection";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -610,7 +590,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -619,7 +598,7 @@ print_r($result["detectedObjects"]);
 
 ?>
 ```
-  
+
 </details>
 
 </details>

+ 27 - 23
docs/pipeline_usage/tutorials/information_extration_pipelines/document_scene_information_extraction.md

@@ -125,7 +125,7 @@ from paddlex import create_pipeline
 predict = create_pipeline( pipeline="PP-ChatOCRv3-doc",
                             llm_name="ernie-3.5",
                             llm_params = {"api_type":"qianfan","ak":"","sk":""} )  ## 请填入您的ak与sk,否则无法调用大模型
-                            
+
 visual_result, visual_inf = predict(["contract.pdf"])
 
 for res in visual_result:
@@ -198,13 +198,13 @@ Pipeline:
   text_det_model: PP-OCRv4_server_det
   text_rec_model: PP-OCRv4_server_rec
   seal_text_det_model: PP-OCRv4_server_seal_det
-  doc_image_ori_cls_model: null 
-  doc_image_unwarp_model: null 
+  doc_image_ori_cls_model: null
+  doc_image_unwarp_model: null
   llm_name: "ernie-3.5"
-  llm_params: 
+  llm_params:
     api_type: qianfan
-    ak: 
-    sk: 
+    ak:
+    sk:
 ```
 
 在上述配置中,您可以修改产线各模块加载的模型,也可以修改使用的大模型。各模块支持模型列表请参考模块文档,大模型支持列表为:ernie-4.0、ernie-3.5、ernie-3.5-8k、ernie-lite、ernie-tiny-8k、ernie-speed、ernie-speed-128k、ernie-char-8k。
@@ -219,7 +219,7 @@ from paddlex import create_pipeline
 predict = create_pipeline( pipeline="./my_path/PP-ChatOCRv3-doc.yaml",
                             llm_name="ernie-3.5",
                             llm_params = {"api_type":"qianfan","ak":"","sk":""} )  ## 请填入您的ak与sk,否则无法调用大模型
-                            
+
 visual_result, visual_inf = predict(["contract.pdf"])
 
 for res in visual_result:
@@ -243,9 +243,9 @@ print(predict.chat("乙方,手机号"))
 
 下面是API参考和多语言服务调用示例:
 
-<details>  
-<summary>API参考</summary>  
-  
+<details>
+<summary>API参考</summary>
+
 对于服务提供的所有操作:
 
 - 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
@@ -339,7 +339,7 @@ print(predict.chat("乙方,手机号"))
         |`llmParams`|`object`|大语言模型API参数。|否|
 
         当前,`llmParams`可以采用如下两种形式之一:
-        
+
         ```json
         {
           "apiType": "qianfan",
@@ -378,7 +378,7 @@ print(predict.chat("乙方,手机号"))
         |`llmParams`|`object`|大语言模型API参数。|否|
 
         当前,`llmParams`可以采用如下两种形式之一:
-        
+
         ```json
         {
           "apiType": "qianfan",
@@ -423,7 +423,7 @@ print(predict.chat("乙方,手机号"))
         |`llmParams`|`object`|大语言模型API参数。|否|
 
         当前,`llmParams`可以采用如下两种形式之一:
-        
+
         ```json
         {
           "apiType": "qianfan",
@@ -457,11 +457,11 @@ print(predict.chat("乙方,手机号"))
 </details>
 
 <details>
-<summary>多语言调用服务示例</summary>  
+<summary>多语言调用服务示例</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import pprint
@@ -475,8 +475,8 @@ API_KEY = "{千帆平台API key}"
 SECRET_KEY = "{千帆平台secret key}"
 LLM_NAME = "ernie-3.5"
 LLM_PARAMS = {
-    "apiType": "qianfan", 
-    "apiKey": API_KEY, 
+    "apiType": "qianfan",
+    "apiKey": API_KEY,
     "secretKey": SECRET_KEY,
 }
 
@@ -485,8 +485,12 @@ if __name__ == "__main__":
     file_path = "./demo.jpg"
     keys = ["电话"]
 
+    with open(file_path, "rb") as file:
+        file_bytes = file.read()
+        file_data = base64.b64encode(file_bytes).decode("ascii")
+
     payload = {
-        "file": file_path,
+        "file": file_data,
         "useOricls": True,
         "useCurve": True,
         "useUvdoc": True,
@@ -577,7 +581,7 @@ if __name__ == "__main__":
     print("Final result:")
     print(len(result_chat["chatResult"]))
 ```
-</details>  
+</details>
 </details>
 <br/>
 
@@ -629,7 +633,7 @@ from paddlex import create_pipeline
 predict = create_pipeline( pipeline="PP-ChatOCRv3-doc",
                             llm_name="ernie-3.5",
                             llm_params = {"api_type":"qianfan","ak":"","sk":""},  ## 请填入您的ak与sk,否则无法调用大模型
-                            device = "gpu:0" ) 
+                            device = "gpu:0" )
 ```
 此时,若您想将硬件切换为昇腾 NPU,仅需对脚本中的 `--device` 修改为 npu 即可:
 
@@ -638,6 +642,6 @@ from paddlex import create_pipeline
 predict = create_pipeline( pipeline="PP-ChatOCRv3-doc",
                             llm_name="ernie-3.5",
                             llm_params = {"api_type":"qianfan","ak":"","sk":""},  ## 请填入您的ak与sk,否则无法调用大模型
-                            device = "npu:0" ) 
+                            device = "npu:0" )
 ```
 若您想在更多种类的硬件上使用通用文档场景信息抽取产线,请参考[PaddleX多硬件使用指南](../../../other_devices_support/installation_other_devices.md)。

+ 121 - 212
docs/pipeline_usage/tutorials/information_extration_pipelines/document_scene_information_extraction_en.md

@@ -138,13 +138,13 @@ Pipeline:
   text_det_model: PP-OCRv4_server_det
   text_rec_model: PP-OCRv4_server_rec
   seal_text_det_model: PP-OCRv4_server_seal_det
-  doc_image_ori_cls_model: null 
-  doc_image_unwarp_model: null 
+  doc_image_ori_cls_model: null
+  doc_image_unwarp_model: null
   llm_name: "ernie-3.5"
-  llm_params: 
+  llm_params:
     api_type: qianfan
-    ak: 
-    sk: 
+    ak:
+    sk:
 ```
 
 In the above configuration, you can modify the models loaded by each module of the pipeline, as well as the large language model used. Please refer to the module documentation for the list of supported models for each module, and the list of supported large language models includes: ernie-4.0, ernie-3.5, ernie-3.5-8k, ernie-lite, ernie-tiny-8k, ernie-speed, ernie-speed-128k, ernie-char-8k.
@@ -159,7 +159,7 @@ from paddlex import create_pipeline
 predict = create_pipeline(pipeline="./my_path/PP-ChatOCRv3-doc.yaml",
                           llm_name="ernie-3.5",
                           llm_params={"api_type":"qianfan","ak":"","sk":""} )  ## Please fill in your ak and sk, or you will not be able to call the large language model
-                          
+
 visual_result, visual_inf = predict(["contract.pdf"])
 
 for res in visual_result:
@@ -183,225 +183,130 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Fixed as `0`. |
+    | `errorMsg` | `string` | Error description. Fixed as `"Success"`. |
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    | `errorCode` | `integer` | Error code. Same as the response status code. |
+    | `errorMsg` | `string` | Error description. |
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`analyzeImage`**
 
-    使用计算机视觉模型对图像进行分析,获得OCR、表格识别结果等,并提取图像中的关键信息。
+    Analyzes images using computer vision models to obtain OCR, table recognition results, etc., and extracts key information from the images.
 
     `POST /chatocr-vision`
 
-    - 请求体的属性如下:
-
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件或PDF文件的URL,或上述类型文件内容的Base64编码结果。对于超过10页的PDF文件,只有前10页的内容会被使用。|是|
-        |`fileType`|`integer`|文件类型。`0`表示PDF文件,`1`表示图像文件。若请求体无此属性,则服务将尝试根据URL自动推断文件类型。|否|
-        |`useOricls`|`boolean`|是否启用文档图像方向分类功能。默认启用该功能。|否|
-        |`useCurve`|`boolean`|是否启用印章文本检测功能。默认启用该功能。|否|
-        |`useUvdoc`|`boolean`|是否启用文本图像矫正功能。默认启用该功能。|否|
-        |`inferenceParams`|`object`|推理参数。|否|
-
-        `inferenceParams`的属性如下:
-
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`maxLongSide`|`integer`|推理时,若文本检测模型的输入图像较长边的长度大于`maxLongSide`,则将对图像进行缩放,使其较长边的长度等于`maxLongSide`。|否|
-
-    - 请求处理成功时,响应体的`result`具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`visionResults`|`array`|使用计算机视觉模型得到的分析结果。数组长度为1(对于图像输入)或文档页数与10中的较小者(对于PDF输入)。对于PDF输入,数组中的每个元素依次表示PDF文件中每一页的处理结果。|
-        |`visionInfo`|`object`|图像中的关键信息,可用作其他操作的输入。|
-
-        `visionResults`中的每个元素为一个`object`,具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`texts`|`array`|文本位置、内容和得分。|
-        |`tables`|`array`|表格位置和内容。|
-        |`inputImage`|`string`|输入图像。图像为JPEG格式,使用Base64编码。|
-        |`ocrImage`|`string`|OCR结果图。图像为JPEG格式,使用Base64编码。|
-        |`layoutImage`|`string`|版面区域检测结果图。图像为JPEG格式,使用Base64编码。|
-
-        `texts`中的每个元素为一个`object`,具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`poly`|`array`|文本位置。数组中元素依次为包围文本的多边形的顶点坐标。|
-        |`text`|`string`|文本内容。|
-        |`score`|`number`|文本识别得分。|
-
-        `tables`中的每个元素为一个`object`,具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`bbox`|`array`|表格位置。数组中元素依次为边界框左上角x坐标、左上角y坐标、右下角x坐标以及右下角y坐标。|
-        |`html`|`string`|HTML格式的表格识别结果。|
-
-- **`buildVectorStore`**
-
-    构建向量数据库。
-
-    `POST /chatocr-vector`
-
-    - 请求体的属性如下:
-
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`visionInfo`|`object`|图像中的关键信息。由`analyzeImage`操作提供。|是|
-        |`minChars`|`integer`|启用向量数据库的最小数据长度。|否|
-        |`llmRequestInterval`|`number`|调用大语言模型API的间隔时间。|否|
-        |`llmName`|`string`|大语言模型名称。|否|
-        |`llmParams`|`object`|大语言模型API参数。|否|
-
-        当前,`llmParams`可以采用如下两种形式之一:
-        
-        ```json
-        {
-          "apiType": "qianfan",
-          "apiKey": "{千帆平台API key}",
-          "secretKey": "{千帆平台secret key}"
-        }
-        ```
-
-        ```json
-        {
-          "apiType": "{aistudio}",
-          "accessToken": "{AI Studio访问令牌}"
-        }
-        ```
-
-    - 请求处理成功时,响应体的`result`具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`vectorStore`|`object`|向量数据库序列化结果,可用作其他操作的输入。|
-
-- **`retrieveKnowledge`**
-
-    进行知识检索。
-
-    `POST /chatocr-retrieval`
-
-    - 请求体的属性如下:
-
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`keys`|`array`|关键词列表。|是|
-        |`vectorStore`|`object`|向量数据库序列化结果。由`buildVectorStore`操作提供。|是|
-        |`visionInfo`|`object`|图像中的关键信息。由`analyzeImage`操作提供。|是|
-        |`llmName`|`string`|大语言模型名称。|否|
-        |`llmParams`|`object`|大语言模型API参数。|否|
-
-        当前,`llmParams`可以采用如下两种形式之一:
-        
-        ```json
-        {
-          "apiType": "qianfan",
-          "apiKey": "{千帆平台API key}",
-          "secretKey": "{千帆平台secret key}"
-        }
-        ```
-
-        ```json
-        {
-          "apiType": "{aistudio}",
-          "accessToken": "{AI Studio访问令牌}"
-        }
-        ```
-
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - Request body attributes:
+
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        | `image` | `string` | The URL of an image file or PDF file accessible by the service, or the Base64 encoded result of the content of the above-mentioned file types. For PDF files with more than 10 pages, only the content of the first 10 pages will be used. | Yes |
+        | `fileType` | `integer` | File type. `0` indicates a PDF file, `1` indicates an image file. If this attribute is not present in the request body, the service will attempt to automatically infer the file type based on the URL. | No |
+        | `useOricls` | `boolean` | Whether to enable document image orientation classification. This feature is enabled by default. | No |
+        | `useCurve` | `boolean` | Whether to enable seal text detection. This feature is enabled by default. | No |
+        | `useUvdoc` | `boolean` | Whether to enable text image correction. This feature is enabled by default. | No |
+        | `inferenceParams` | `object` | Inference parameters. | No |
+
+        Properties of `inferenceParams`:
+
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        | `maxLongSide` | `integer` | During inference, if the length of the longer side of the input image for the text detection model is greater than `maxLongSide`, the image will be scaled so that the length of the longer side equals `maxLongSide`. | No |
+
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
+
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `visionResults` | `array` | Analysis results obtained using computer vision models. The array length is 1 (for image input) or the smaller of the number of document pages and 10 (for PDF input). For PDF input, each element in the array represents the processing result of each page in the PDF file. |
+        | `visionInfo` | `object` | Key information in the image, which can be used as input for other operations. |
+
+        Each element in `visionResults` is an `object` with the following attributes:
+
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `texts` | `array` | Text positions, contents, and scores. |
+        | `tables` | `array` | Table positions and contents. |
+        | `inputImage` | `string` | Input image. The image is in JPEG format and encoded using Base64. |
+        | `ocrImage` | `string` | OCR result image. The image is in JPEG format and encoded using Base64. |
+        | `layoutImage` | `string` | Layout area detection result image. The image is in JPEG format and encoded using Base64. |
+
+        Each element in `texts` is an `object` with the following attributes:
+
+        | Name | Type | Description |
+        |------|------|-------------|
+        | `poly` | `array` | Text position. The elements in the array are the vertex coordinates of the polygon enclosing the text in```markdown
+### chat
+
+Interact with large language models to extract key information.
+
+`POST /chatocr-vision`
+
+- Request body attributes:
+
+    | Name | Type | Description | Required |
+    |------|------|-------------|----------|
+    |`keys`|`array`|List of keywords.|Yes|
+    |`visionInfo`|`object`|Key information from the image. Provided by the `analyzeImage` operation.|Yes|
+    |`taskDescription`|`string`|Task prompt.|No|
+    |`rules`|`string`|Extraction rules. Used to customize the information extraction rules, e.g., to specify output formats.|No|
+    |`fewShot`|`string`|Example prompts.|No|
+    |`useVectorStore`|`boolean`|Whether to enable the vector database. Enabled by default.|No|
+    |`vectorStore`|`object`|Serialized result of the vector database. Provided by the `buildVectorStore` operation.|No|
+    |`retrievalResult`|`string`|Knowledge retrieval result. Provided by the `retrieveKnowledge` operation.|No|
+    |`returnPrompts`|`boolean`|Whether to return the prompts used. Enabled by default.|No|
+    |`llmName`|`string`|Name of the large language model.|No|
+    |`llmParams`|`object`|API parameters for the large language model.|No|
+
+    Currently, `llmParams` can take the following form:
+
+    ```json
+    {
+      "apiType": "qianfan",
+      "apiKey": "{Qianfan Platform API key}",
+      "secretKey": "{Qianfan Platform secret key}"
+    }
+    ```
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`retrievalResult`|`string`|知识检索结果,可用作其他操作的输入。|
-
-- **`chat`**
+- On successful request processing, the `result` in the response body has the following attributes:
 
-    与大语言模型交互,利用大语言模型提炼关键信息。
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`chatResult`|`string`|Extracted key information result.|
+    |`prompts`|`object`|Prompts used.|
 
-    `POST /chatocr-vision`
+    Properties of `prompts`:
 
-    - 请求体的属性如下:
-
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`keys`|`array`|关键词列表。|是|
-        |`visionInfo`|`object`|图像中的关键信息。由`analyzeImage`操作提供。|是|
-        |`taskDescription`|`string`|提示词任务。|否|
-        |`rules`|`string`|提示词规则。用于自定义信息抽取规则,例如规范输出格式。|否|
-        |`fewShot`|`string`|提示词示例。|否|
-        |`useVectorStore`|`boolean`|是否启用向量数据库。默认启用。|否|
-        |`vectorStore`|`object`|向量数据库序列化结果。由`buildVectorStore`操作提供。|否|
-        |`retrievalResult`|`string`|知识检索结果。由`retrieveKnowledge`操作提供。|否|
-        |`returnPrompts`|`boolean`|是否返回使用的提示词。默认启用。|否|
-        |`llmName`|`string`|大语言模型名称。|否|
-        |`llmParams`|`object`|大语言模型API参数。|否|
-
-        当前,`llmParams`可以采用如下两种形式之一:
-        
-        ```json
-        {
-          "apiType": "qianfan",
-          "apiKey": "{千帆平台API key}",
-          "secretKey": "{千帆平台secret key}"
-        }
-        ```
-
-        ```json
-        {
-          "apiType": "{aistudio}",
-          "accessToken": "{AI Studio访问令牌}"
-        }
-        ```
-
-    - 请求处理成功时,响应体的`result`具有如下属性:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`chatResult`|`string`|关键信息抽取结果。|
-        |`prompts`|`object`|使用的提示词。|
-
-        `prompts`的属性如下:
-
-        |名称|类型|含义|
-        |-|-|-|
-        |`ocr`|`string`|OCR提示词。|
-        |`table`|`string`|表格提示词。|
-        |`html`|`string`|HTML提示词。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`ocr`|`string`|OCR prompt.|
+    |`table`|`string`|Table prompt.|
+    |`html`|`string`|HTML prompt.|
 
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import pprint
@@ -411,22 +316,26 @@ import requests
 
 
 API_BASE_URL = "http://0.0.0.0:8080"
-API_KEY = "{千帆平台API key}"
-SECRET_KEY = "{千帆平台secret key}"
+API_KEY = "{Qianfan Platform API key}"
+SECRET_KEY = "{Qianfan Platform secret key}"
 LLM_NAME = "ernie-3.5"
 LLM_PARAMS = {
-    "apiType": "qianfan", 
-    "apiKey": API_KEY, 
+    "apiType": "qianfan",
+    "apiKey": API_KEY,
     "secretKey": SECRET_KEY,
 }
 
 
 if __name__ == "__main__":
     file_path = "./demo.jpg"
-    keys = ["电话"]
+    keys = ["phone number"]
+
+    with open(file_path, "rb") as file:
+        file_bytes = file.read()
+        file_data = base64.b64encode(file_bytes).decode("ascii")
 
     payload = {
-        "file": file_path,
+        "file": file_data,
         "useOricls": True,
         "useCurve": True,
         "useUvdoc": True,
@@ -517,7 +426,7 @@ if __name__ == "__main__":
     print("Final result:")
     print(len(result_chat["chatResult"]))
 ```
-</details>  
+</details>
 </details>
 <br/>
 
@@ -568,6 +477,6 @@ from paddlex import create_pipeline
 predict = create_pipeline(pipeline="PP-ChatOCRv3-doc",
                             llm_name="ernie-3.5",
                             llm_params = {"api_type":"qianfan","ak":"","sk":""},  ## Please fill in your ak and sk, or you will not be able to call the large model
-                            device = "npu:0") 
+                            device = "npu:0")
 ```
 If you want to use the PP-ChatOCRv3-doc Pipeline on more types of hardware, please refer to the [PaddleX Multi-Device Usage Guide](../../../installation/installation_other_devices_en.md).

+ 152 - 173
docs/pipeline_usage/tutorials/ocr_pipelines/OCR_en.md

@@ -203,65 +203,65 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error description. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error description.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    获取图像OCR结果。
+    Obtain OCR results from an image.
 
     `POST /ocr`
 
-    - 请求体的属性如下:
+    - Request body attributes:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
-        |`inferenceParams`|`object`|推理参数。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of an image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
+        |`inferenceParams`|`object`|Inference parameters.|No|
 
-        `inferenceParams`的属性如下:
+        Properties of `inferenceParams`:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`maxLongSide`|`integer`|推理时,若文本检测模型的输入图像较长边的长度大于`maxLongSide`,则将对图像进行缩放,使其较长边的长度等于`maxLongSide`。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`maxLongSide`|`integer`|During inference, if the length of the longer side of the input image for the text detection model is greater than `maxLongSide`, the image will be scaled so that the length of the longer side equals `maxLongSide`.|No|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` in the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`texts`|`array`|文本位置、内容和得分。|
-        |`image`|`string`|OCR结果图,其中标注检测到的文本位置。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`texts`|`array`|Positions, contents, and scores of texts.|
+        |`image`|`string`|OCR result image with detected text positions annotated. The image is in JPEG format and encoded in Base64.|
 
-        `texts`中的每个元素为一个`object`,具有如下属性:
+        Each element in `texts` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`poly`|`array`|文本位置。数组中元素依次为包围文本的多边形的顶点坐标。|
-        |`text`|`string`|文本内容。|
-        |`score`|`number`|文本识别得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`poly`|`array`|Text position. Elements in the array are the vertex coordinates of the polygon enclosing the text.|
+        |`text`|`string`|Text content.|
+        |`score`|`number`|Text recognition score.|
 
-        `result`示例如下:
+        Example of `result`:
 
         ```json
         {
@@ -285,7 +285,7 @@ Below are the API references and multi-language service invocation examples:
                   311
                 ]
               ],
-              "text": "北京南站",
+              "text": "Beijing South Railway Station",
               "score": 0.9
             },
             {
@@ -307,7 +307,7 @@ Below are the API references and multi-language service invocation examples:
                   315
                 ]
               ],
-              "text": "天津站",
+              "text": "Tianjin Railway Station",
               "score": 0.5
             }
           ],
@@ -318,30 +318,27 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/ocr" # 服务URL
+API_URL = "http://localhost:8080/ocr"
 image_path = "./demo.jpg"
 output_image_path = "./out.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_image_path, "wb") as file:
@@ -350,12 +347,12 @@ print(f"Output image saved at {output_image_path}")
 print("\nTexts:")
 print(result["texts"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -371,7 +368,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -388,9 +384,7 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/ocr", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -420,12 +414,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -439,20 +433,18 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/ocr"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
-        String outputImagePath = "./out.jpg"; // 输出图像
+        String API_URL = "http://localhost:8080/ocr";
+        String imagePath = "./demo.jpg";
+        String outputImagePath = "./out.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -461,7 +453,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -483,101 +474,98 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/ocr"
-	imagePath := "./demo.jpg"
-	outputImagePath := "./out.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Image      string   `json:"image"`
-			Texts []map[string]interface{} `json:"texts"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
-	fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
-	fmt.Println("\nTexts:")
-	for _, category := range respData.Result.Texts {
-		fmt.Println(category)
-	}
+    API_URL := "http://localhost:8080/ocr"
+    imagePath := "./demo.jpg"
+    outputImagePath := "./out.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Image      string   `json:"image"`
+            Texts []map[string]interface{} `json:"texts"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputImageData, err := base64.StdEncoding.DecodeString(respData.Result.Image)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputImagePath, outputImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
+    fmt.Printf("Image saved at %s.jpg\n", outputImagePath)
+    fmt.Println("\nTexts:")
+    for _, category := range respData.Result.Texts {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -597,18 +585,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -622,12 +607,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -641,20 +626,17 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
     const imageBuffer = Buffer.from(result["image"], 'base64');
     fs.writeFile(outputImagePath, imageBuffer, (err) => {
@@ -668,24 +650,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/ocr"; // 服务URL
+$API_URL = "http://localhost:8080/ocr";
 $image_path = "./demo.jpg";
 $output_image_path = "./out.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -693,7 +673,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($output_image_path, base64_decode($result["image"]));
 echo "Output image saved at " . $output_image_path . "\n";
@@ -702,7 +681,7 @@ print_r($result["texts"]);
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>
@@ -751,4 +730,4 @@ Now, if you want to switch the hardware to Ascend NPU, you only need to modify t
 paddlex --pipeline OCR --input general_ocr_002.png --device npu:0
 ```
 
-If you want to use the General OCR pipeline on more types of hardware, please refer to the [PaddleX Multi-Hardware Usage Guide](../../../installation/installation_other_devices_en.md).
+If you want to use the General OCR pipeline on more types of hardware, please refer to the [PaddleX Multi-Hardware Usage Guide](../../../installation/installation_other_devices_en.md).

+ 119 - 119
docs/pipeline_usage/tutorials/ocr_pipelines/table_recognition.md

@@ -270,9 +270,9 @@ for res in output:
 
 下面是API参考和多语言服务调用示例:
 
-<details>  
-<summary>API参考</summary>  
-  
+<details>
+<summary>API参考</summary>
+
 对于服务提供的所有操作:
 
 - 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
@@ -331,11 +331,11 @@ for res in output:
 </details>
 
 <details>
-<summary>多语言调用服务示例</summary>  
+<summary>多语言调用服务示例</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
@@ -343,7 +343,7 @@ import requests
 API_URL = "http://localhost:8080/table-recognition" # 服务URL
 image_path = "./demo.jpg"
 ocr_image_path = "./ocr.jpg"
-layout_image_path = "./table.jpg"
+layout_image_path = "./layout.jpg"
 
 # 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
@@ -367,12 +367,12 @@ print(f"Output image saved at {layout_image_path}")
 print("\nDetected tables:")
 print(result["tables"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -383,7 +383,7 @@ int main() {
     httplib::Client client("localhost:8080");
     const std::string imagePath = "./demo.jpg";
     const std::string ocrImagePath = "./ocr.jpg";
-    const std::string layoutImagePath = "./table.jpg";
+    const std::string layoutImagePath = "./layout.jpg";
 
     httplib::Headers headers = {
         {"Content-Type", "application/json"}
@@ -450,12 +450,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -472,7 +472,7 @@ public class Main {
         String API_URL = "http://localhost:8080/table-recognition"; // 服务URL
         String imagePath = "./demo.jpg"; // 本地图像
         String ocrImagePath = "./ocr.jpg";
-        String layoutImagePath = "./table.jpg";
+        String layoutImagePath = "./layout.jpg";
 
         // 对本地图像进行Base64编码
         File file = new File(imagePath);
@@ -522,116 +522,116 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/table-recognition"
-	imagePath := "./demo.jpg"
-	ocrImagePath := "./ocr.jpg"
-	layoutImagePath := "./table.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
+    API_URL := "http://localhost:8080/table-recognition"
+    imagePath := "./demo.jpg"
+    ocrImagePath := "./ocr.jpg"
+    layoutImagePath := "./layout.jpg"
+
+    // 对本地图像进行Base64编码
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    // 调用API
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
 
     // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			OcrImage      string   `json:"ocrImage"`
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            OcrImage      string   `json:"ocrImage"`
             TableImage      string   `json:"layoutImage"`
-			Tables []map[string]interface{} `json:"tables"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
+            Tables []map[string]interface{} `json:"tables"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
     fmt.Printf("Image saved at %s.jpg\n", ocrImagePath)
 
     layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.TableImage)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
     fmt.Printf("Image saved at %s.jpg\n", layoutImagePath)
 
-	fmt.Println("\nDetected tables:")
-	for _, category := range respData.Result.Tables {
-		fmt.Println(category)
-	}
+    fmt.Println("\nDetected tables:")
+    for _, category := range respData.Result.Tables {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -646,7 +646,7 @@ class Program
     static readonly string API_URL = "http://localhost:8080/table-recognition";
     static readonly string imagePath = "./demo.jpg";
     static readonly string ocrImagePath = "./ocr.jpg";
-    static readonly string layoutImagePath = "./table.jpg";
+    static readonly string layoutImagePath = "./layout.jpg";
 
     static async Task Main(string[] args)
     {
@@ -682,12 +682,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -695,7 +695,7 @@ const fs = require('fs');
 const API_URL = 'http://localhost:8080/table-recognition'
 const imagePath = './demo.jpg'
 const ocrImagePath = "./ocr.jpg";
-const layoutImagePath = "./table.jpg";
+const layoutImagePath = "./layout.jpg";
 
 let config = {
    method: 'POST',
@@ -737,19 +737,19 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
 $API_URL = "http://localhost:8080/table-recognition"; // 服务URL
 $image_path = "./demo.jpg";
 $ocr_image_path = "./ocr.jpg";
-$layout_image_path = "./table.jpg";
+$layout_image_path = "./layout.jpg";
 
 // 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
@@ -776,7 +776,7 @@ print_r($result["tables"]);
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>

+ 163 - 183
docs/pipeline_usage/tutorials/ocr_pipelines/table_recognition_en.md

@@ -202,92 +202,89 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    定位并识别图中的表格。
+    Locate and recognize tables in images.
 
     `POST /table-recognition`
 
-    - 请求体的属性如下:
+    - Request body attributes:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`image`|`string`|服务可访问的图像文件的URL或图像文件内容的Base64编码结果。|是|
-        |`inferenceParams`|`object`|推理参数。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`image`|`string`|The URL of an image file accessible by the service or the Base64 encoded result of the image file content.|Yes|
+        |`inferenceParams`|`object`|Inference parameters.|No|
 
-        `inferenceParams`的属性如下:
+        Properties of `inferenceParams`:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`maxLongSide`|`integer`|推理时,若文本检测模型的输入图像较长边的长度大于`maxLongSide`,则将对图像进行缩放,使其较长边的长度等于`maxLongSide`。|否|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`maxLongSide`|`integer`|During inference, if the length of the longer side of the input image for the text detection model is greater than `maxLongSide`, the image will be scaled so that the length of the longer side equals `maxLongSide`.|No|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`tables`|`array`|表格位置和内容。|
-        |`layoutImage`|`string`|版面区域检测结果图。图像为JPEG格式,使用Base64编码。|
-        |`ocrImage`|`string`|OCR结果图。图像为JPEG格式,使用Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`tables`|`array`|Positions and contents of tables.|
+        |`layoutImage`|`string`|Layout area detection result image. The image is in JPEG format and encoded using Base64.|
+        |`ocrImage`|`string`|OCR result image. The image is in JPEG format and encoded using Base64.|
 
-        `tables`中的每个元素为一个`object`,具有如下属性:
+        Each element in `tables` is an `object` with the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`bbox`|`array`|表格位置。数组中元素依次为边界框左上角x坐标、左上角y坐标、右下角x坐标以及右下角y坐标。|
-        |`html`|`string`|HTML格式的表格识别结果。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`bbox`|`array`|Table position. The elements in the array are the x-coordinate of the top-left corner, the y-coordinate of the top-left corner, the x-coordinate of the bottom-right corner, and the y-coordinate of the bottom-right corner of the bounding box, respectively.|
+        |`html`|`string`|Table recognition result in HTML format.|
 
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/table-recognition" # 服务URL
+API_URL = "http://localhost:8080/table-recognition"
 image_path = "./demo.jpg"
 ocr_image_path = "./ocr.jpg"
-layout_image_path = "./table.jpg"
+layout_image_path = "./layout.jpg"
 
-# 对本地图像进行Base64编码
 with open(image_path, "rb") as file:
     image_bytes = file.read()
     image_data = base64.b64encode(image_bytes).decode("ascii")
 
-payload = {"image": image_data}  # Base64编码的文件内容或者图像URL
+payload = {"image": image_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(ocr_image_path, "wb") as file:
@@ -299,12 +296,12 @@ print(f"Output image saved at {layout_image_path}")
 print("\nDetected tables:")
 print(result["tables"])
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -315,13 +312,12 @@ int main() {
     httplib::Client client("localhost:8080");
     const std::string imagePath = "./demo.jpg";
     const std::string ocrImagePath = "./ocr.jpg";
-    const std::string layoutImagePath = "./table.jpg";
+    const std::string layoutImagePath = "./layout.jpg";
 
     httplib::Headers headers = {
         {"Content-Type", "application/json"}
     };
 
-    // 对本地图像进行Base64编码
     std::ifstream file(imagePath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -338,9 +334,8 @@ int main() {
     jsonObj["image"] = encodedImage;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/table-recognition", headers, body, "application/json");
-    // 处理接口返回数据
+
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -382,12 +377,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -401,21 +396,19 @@ import java.util.Base64;
 
 public class Main {
     public static void main(String[] args) throws IOException {
-        String API_URL = "http://localhost:8080/table-recognition"; // 服务URL
-        String imagePath = "./demo.jpg"; // 本地图像
+        String API_URL = "http://localhost:8080/table-recognition";
+        String imagePath = "./demo.jpg";
         String ocrImagePath = "./ocr.jpg";
-        String layoutImagePath = "./table.jpg";
+        String layoutImagePath = "./layout.jpg";
 
-        // 对本地图像进行Base64编码
         File file = new File(imagePath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String imageData = Base64.getEncoder().encodeToString(fileContent);
 
         ObjectMapper objectMapper = new ObjectMapper();
         ObjectNode params = objectMapper.createObjectNode();
-        params.put("image", imageData); // Base64编码的文件内容或者图像URL
+        params.put("image", imageData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -424,7 +417,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -454,116 +446,113 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/table-recognition"
-	imagePath := "./demo.jpg"
-	ocrImagePath := "./ocr.jpg"
-	layoutImagePath := "./table.jpg"
-
-	// 对本地图像进行Base64编码
-	imageBytes, err := ioutil.ReadFile(imagePath)
-	if err != nil {
-		fmt.Println("Error reading image file:", err)
-		return
-	}
-	imageData := base64.StdEncoding.EncodeToString(imageBytes)
-
-	payload := map[string]string{"image": imageData} // Base64编码的文件内容或者图像URL
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-    // 处理接口返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			OcrImage      string   `json:"ocrImage"`
+    API_URL := "http://localhost:8080/table-recognition"
+    imagePath := "./demo.jpg"
+    ocrImagePath := "./ocr.jpg"
+    layoutImagePath := "./layout.jpg"
+
+    imageBytes, err := ioutil.ReadFile(imagePath)
+    if err != nil {
+        fmt.Println("Error reading image file:", err)
+        return
+    }
+    imageData := base64.StdEncoding.EncodeToString(imageBytes)
+
+    payload := map[string]string{"image": imageData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            OcrImage      string   `json:"ocrImage"`
             TableImage      string   `json:"layoutImage"`
-			Tables []map[string]interface{} `json:"tables"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
+            Tables []map[string]interface{} `json:"tables"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    ocrImageData, err := base64.StdEncoding.DecodeString(respData.Result.OcrImage)
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(ocrImagePath, ocrImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
     fmt.Printf("Image saved at %s.jpg\n", ocrImagePath)
 
     layoutImageData, err := base64.StdEncoding.DecodeString(respData.Result.TableImage)
-	if err != nil {
-		fmt.Println("Error decoding base64 image data:", err)
-		return
-	}
-	err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)
-	if err != nil {
-		fmt.Println("Error writing image to file:", err)
-		return
-	}
+    if err != nil {
+        fmt.Println("Error decoding base64 image data:", err)
+        return
+    }
+    err = ioutil.WriteFile(layoutImagePath, layoutImageData, 0644)
+    if err != nil {
+        fmt.Println("Error writing image to file:", err)
+        return
+    }
     fmt.Printf("Image saved at %s.jpg\n", layoutImagePath)
 
-	fmt.Println("\nDetected tables:")
-	for _, category := range respData.Result.Tables {
-		fmt.Println(category)
-	}
+    fmt.Println("\nDetected tables:")
+    for _, category := range respData.Result.Tables {
+        fmt.Println(category)
+    }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -578,24 +567,21 @@ class Program
     static readonly string API_URL = "http://localhost:8080/table-recognition";
     static readonly string imagePath = "./demo.jpg";
     static readonly string ocrImagePath = "./ocr.jpg";
-    static readonly string layoutImagePath = "./table.jpg";
+    static readonly string layoutImagePath = "./layout.jpg";
 
     static async Task Main(string[] args)
     {
         var httpClient = new HttpClient();
 
-        // 对本地图像进行Base64编码
         byte[] imageBytes = File.ReadAllBytes(imagePath);
         string image_data = Convert.ToBase64String(imageBytes);
 
-        var payload = new JObject{ { "image", image_data } }; // Base64编码的文件内容或者图像URL
+        var payload = new JObject{ { "image", image_data } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -614,12 +600,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -627,27 +613,24 @@ const fs = require('fs');
 const API_URL = 'http://localhost:8080/table-recognition'
 const imagePath = './demo.jpg'
 const ocrImagePath = "./ocr.jpg";
-const layoutImagePath = "./table.jpg";
+const layoutImagePath = "./layout.jpg";
 
 let config = {
    method: 'POST',
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'image': encodeImageToBase64(imagePath)  // Base64编码的文件内容或者图像URL
+    'image': encodeImageToBase64(imagePath)
   })
 };
 
-// 对本地图像进行Base64编码
 function encodeImageToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
 }
 
-// 调用API
 axios.request(config)
 .then((response) => {
-    // 处理接口返回数据
     const result = response.data["result"];
 
     const imageBuffer = Buffer.from(result["ocrImage"], 'base64');
@@ -669,25 +652,23 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/table-recognition"; // 服务URL
+$API_URL = "http://localhost:8080/table-recognition";
 $image_path = "./demo.jpg";
 $ocr_image_path = "./ocr.jpg";
-$layout_image_path = "./table.jpg";
+$layout_image_path = "./layout.jpg";
 
-// 对本地图像进行Base64编码
 $image_data = base64_encode(file_get_contents($image_path));
-$payload = array("image" => $image_data); // Base64编码的文件内容或者图像URL
+$payload = array("image" => $image_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -695,7 +676,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 file_put_contents($ocr_image_path, base64_decode($result["ocrImage"]));
 echo "Output image saved at " . $ocr_image_path . "\n";
@@ -708,7 +688,7 @@ print_r($result["tables"]);
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>

+ 129 - 153
docs/pipeline_usage/tutorials/time_series_pipelines/time_series_anomaly_detection_en.md

@@ -78,7 +78,7 @@ After running, the result obtained is:
 
 ```json
 {'ts_path': '/root/.paddlex/predict_input/ts_ad.csv', 'anomaly':            label
-timestamp  
+timestamp
 220226         0
 220227         0
 220228         0
@@ -167,49 +167,49 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the attributes of the response body are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error description. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the attributes of the response body are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error description.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    进行时序异常检测。
+    Performs time-series anomaly detection.
 
     `POST /time-series-anomaly-detection`
 
-    - 请求体的属性如下:
+    - Attributes of the request body:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`csv`|`string`|服务可访问的CSV文件的URL或CSV文件内容的Base64编码结果。CSV文件需要使用UTF-8编码。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`csv`|`string`|The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`csv`|`string`|CSV格式的时序异常检测结果。使用UTF-8+Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`csv`|`string`|Time-series anomaly detection results in CSV format. Encoded in UTF-8+Base64.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -220,42 +220,39 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/time-series-anomaly-detection" # 服务URL
+API_URL = "http://localhost:8080/time-series-anomaly-detection"
 csv_path = "./test.csv"
 output_csv_path = "./out.csv"
 
-# 对本地图像进行Base64编码
 with open(csv_path, "rb") as file:
     csv_bytes = file.read()
     csv_data = base64.b64encode(csv_bytes).decode("ascii")
 
 payload = {"csv": csv_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_csv_path, "wb") as f:
     f.write(base64.b64decode(result["csv"]))
 print(f"Output time-series data saved at  {output_csv_path}")
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -271,7 +268,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 进行Base64编码
     std::ifstream file(csvPath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -288,14 +284,11 @@ int main() {
     jsonObj["csv"] = encodedCsv;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/time-series-anomaly-detection", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
 
-        // 保存数据
         encodedCsv = result["csv"];
         decodedString = base64::from_base64(encodedCsv);
         std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());
@@ -316,12 +309,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -339,7 +332,6 @@ public class Main {
         String csvPath = "./test.csv";
         String outputCsvPath = "./out.csv";
 
-        // 对本地csv进行Base64编码
         File file = new File(csvPath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String csvData = Base64.getEncoder().encodeToString(fileContent);
@@ -348,7 +340,6 @@ public class Main {
         ObjectNode params = objectMapper.createObjectNode();
         params.put("csv", csvData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -357,14 +348,12 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
                 JsonNode resultNode = objectMapper.readTree(responseBody);
                 JsonNode result = resultNode.get("result");
 
-                // 保存返回的数据
                 String base64Csv = result.get("csv").asText();
                 byte[] csvBytes = Base64.getDecoder().decode(base64Csv);
                 try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {
@@ -378,97 +367,93 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/time-series-anomaly-detection"
-	csvPath := "./test.csv";
-	outputCsvPath := "./out.csv";
-
-	// 读取csv文件并进行Base64编码
-	csvBytes, err := ioutil.ReadFile(csvPath)
-	if err != nil {
-		fmt.Println("Error reading csv file:", err)
-		return
-	}
-	csvData := base64.StdEncoding.EncodeToString(csvBytes)
-
-	payload := map[string]string{"csv": csvData} // Base64编码的文件内容
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-	// 处理返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Csv string `json:"csv"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	// 将Base64编码的csv数据解码并保存为文件
-	outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)
-	if err != nil {
-		fmt.Println("Error decoding base64 csv data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)
-	if err != nil {
-		fmt.Println("Error writing csv to file:", err)
-		return
-	}
-	fmt.Printf("Output time-series data saved at %s.csv", outputCsvPath)
+    API_URL := "http://localhost:8080/time-series-anomaly-detection"
+    csvPath := "./test.csv";
+    outputCsvPath := "./out.csv";
+
+    csvBytes, err := ioutil.ReadFile(csvPath)
+    if err != nil {
+        fmt.Println("Error reading csv file:", err)
+        return
+    }
+    csvData := base64.StdEncoding.EncodeToString(csvBytes)
+
+    payload := map[string]string{"csv": csvData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Csv string `json:"csv"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)
+    if err != nil {
+        fmt.Println("Error decoding base64 csv data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)
+    if err != nil {
+        fmt.Println("Error writing csv to file:", err)
+        return
+    }
+    fmt.Printf("Output time-series data saved at %s.csv", outputCsvPath)
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -488,22 +473,18 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地csv文件进行Base64编码
         byte[] csvBytes = File.ReadAllBytes(csvPath);
         string csvData = Convert.ToBase64String(csvBytes);
 
-        var payload = new JObject{ { "csv", csvData } }; // Base64编码的文件内容
+        var payload = new JObject{ { "csv", csvData } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
-        // 保存csv文件
         string base64Csv = jsonResponse["result"]["csv"].ToString();
         byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);
         File.WriteAllBytes(outputCsvPath, outputCsvBytes);
@@ -511,12 +492,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -530,11 +511,10 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'csv': encodeFileToBase64(csvPath)  // Base64编码的文件内容
+    'csv': encodeFileToBase64(csvPath)
   })
 };
 
-// 读取csv文件并转换为Base64
 function encodeFileToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
@@ -544,7 +524,6 @@ axios.request(config)
 .then((response) => {
     const result = response.data["result"];
 
-    // 保存csv文件
     const csvBuffer = Buffer.from(result["csv"], 'base64');
     fs.writeFile(outputCsvPath, csvBuffer, (err) => {
       if (err) throw err;
@@ -555,24 +534,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/time-series-anomaly-detection"; // 服务URL
+$API_URL = "http://localhost:8080/time-series-anomaly-detection";
 $csv_path = "./test.csv";
 $output_csv_path = "./out.csv";
 
-// 对本地csv文件进行Base64编码
 $csv_data = base64_encode(file_get_contents($csv_path));
-$payload = array("csv" => $csv_data); // Base64编码的文件内容
+$payload = array("csv" => $csv_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -580,7 +557,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 
 file_put_contents($output_csv_path, base64_decode($result["csv"]));
@@ -588,7 +564,7 @@ echo "Output time-series data saved at " . $output_csv_path . "\n";
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>
@@ -631,4 +607,4 @@ At this point, if you wish to switch the hardware to Ascend NPU, simply modify t
 ```bash
 paddlex --pipeline ts_ad --input ts_ad.csv --device npu:0
 ```
-If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the [PaddleX Multi-Device Usage Guide](../../../other_devices_support/installation_other_devices_en.md).
+If you want to use the General Time-Series Anomaly Detection Pipeline on more diverse hardware, please refer to the [PaddleX Multi-Device Usage Guide](../../../other_devices_support/installation_other_devices_en.md).

+ 119 - 138
docs/pipeline_usage/tutorials/time_series_pipelines/time_series_classification_en.md

@@ -79,7 +79,7 @@ After execution, the result is:
 
 ```bash
 {'ts_path': '/root/.paddlex/predict_input/ts_cls.csv', 'classification':         classid     score
-sample  
+sample
 0             0  0.617688}
 ```
 
@@ -157,50 +157,50 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service:
 
 - **`infer`**
 
-    对时序数据进行分类。
+    Classify time-series data.
 
     `POST /time-series-classification`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`csv`|`string`|服务可访问的CSV文件的URL或CSV文件内容的Base64编码结果。CSV文件需要使用UTF-8编码。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`csv`|`string`|The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` in the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`label`|`string`|类别标签。|
-        |`score`|`number`|类别得分。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`label`|`string`|Class label.|
+        |`score`|`number`|Class score.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -212,39 +212,36 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/time-series-classification" # 服务URL
+API_URL = "http://localhost:8080/time-series-classification"
 csv_path = "./test.csv"
 
-# 对本地图像进行Base64编码
 with open(csv_path, "rb") as file:
     csv_bytes = file.read()
     csv_data = base64.b64encode(csv_bytes).decode("ascii")
 
 payload = {"csv": csv_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 print(f"label: {result['label']}, score: {result['score']}")
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -259,7 +256,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 进行Base64编码
     std::ifstream file(csvPath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -276,9 +272,7 @@ int main() {
     jsonObj["csv"] = encodedCsv;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/time-series-classification", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
@@ -292,12 +286,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -314,7 +308,6 @@ public class Main {
         String API_URL = "http://localhost:8080/time-series-classification";
         String csvPath = "./test.csv";
 
-        // 对本地csv进行Base64编码
         File file = new File(csvPath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String csvData = Base64.getEncoder().encodeToString(fileContent);
@@ -323,7 +316,6 @@ public class Main {
         ObjectNode params = objectMapper.createObjectNode();
         params.put("csv", csvData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -332,7 +324,6 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
@@ -346,86 +337,83 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/time-series-classification"
-	csvPath := "./test.csv";
-
-	// 读取csv文件并进行Base64编码
-	csvBytes, err := ioutil.ReadFile(csvPath)
-	if err != nil {
-		fmt.Println("Error reading csv file:", err)
-		return
-	}
-	csvData := base64.StdEncoding.EncodeToString(csvBytes)
-
-	payload := map[string]string{"csv": csvData} // Base64编码的文件内容
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-	// 处理返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Label string `json:"label"`
+    API_URL := "http://localhost:8080/time-series-classification"
+    csvPath := "./test.csv";
+
+    csvBytes, err := ioutil.ReadFile(csvPath)
+    if err != nil {
+        fmt.Println("Error reading csv file:", err)
+        return
+    }
+    csvData := base64.StdEncoding.EncodeToString(csvBytes)
+
+    payload := map[string]string{"csv": csvData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Label string `json:"label"`
             Score string `json:"score"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	fmt.Printf("label: %s, score: %s\n", respData.Result.Label, respData.Result.Score)
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    fmt.Printf("label: %s, score: %s\n", respData.Result.Label, respData.Result.Score)
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -444,18 +432,15 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地csv文件进行Base64编码
         byte[] csveBytes = File.ReadAllBytes(csvPath);
         string csvData = Convert.ToBase64String(csveBytes);
 
-        var payload = new JObject{ { "csv", csvData } }; // Base64编码的文件内容
+        var payload = new JObject{ { "csv", csvData } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
@@ -465,12 +450,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -483,11 +468,10 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'csv': encodeFileToBase64(csvPath)  // Base64编码的文件内容
+    'csv': encodeFileToBase64(csvPath)
   })
 };
 
-// 读取csv文件并转换为Base64
 function encodeFileToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
@@ -502,23 +486,21 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/time-series-classification"; // 服务URL
+$API_URL = "http://localhost:8080/time-series-classification";
 $csv_path = "./test.csv";
 
-// 对本地csv文件进行Base64编码
 $csv_data = base64_encode(file_get_contents($csv_path));
-$payload = array("csv" => $csv_data); // Base64编码的文件内容
+$payload = array("csv" => $csv_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -526,13 +508,12 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 echo "label: " . $result["label"] . ", score: " . $result["score"];
 
 ?>
 ```
-  
+
 </details>
 </details>
 <br/>
@@ -575,4 +556,4 @@ At this point, if you wish to switch the hardware to Ascend NPU, simply modify t
 paddlex --pipeline ts_cls --input ts_cls.csv --device npu:0
 ```
 
-If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the [PaddleX Multi-Hardware Usage Guide](../../../other_devices_support/installation_other_devices_en.md).
+If you intend to use the General Time Series Classification Pipeline on a wider range of hardware, please refer to the [PaddleX Multi-Hardware Usage Guide](../../../other_devices_support/installation_other_devices_en.md).

+ 128 - 152
docs/pipeline_usage/tutorials/time_series_pipelines/time_series_forecasting_en.md

@@ -80,7 +80,7 @@ After running, the result is:
 
 ```bash
 {'ts_path': '/root/.paddlex/predict_input/ts_fc.csv', 'forecast':                            OT
-date  
+date
 2018-06-26 20:00:00  9.586131
 2018-06-26 21:00:00  9.379762
 2018-06-26 22:00:00  9.252275
@@ -96,7 +96,7 @@ date
 [96 rows x 1 columns]}
 ```
 
-#### 2.2.2 Python Script Integration 
+#### 2.2.2 Python Script Integration
 A few lines of code can complete the quick inference of the production line. Taking the general time series prediction production line as an example:
 
 ```python
@@ -168,49 +168,49 @@ Additionally, PaddleX provides three other deployment methods, detailed as follo
 
 Below are the API references and multi-language service invocation examples:
 
-<details>  
-<summary>API Reference</summary>  
-  
-对于服务提供的所有操作:
+<details>
+<summary>API Reference</summary>
+
+For all operations provided by the service:
 
-- 响应体以及POST请求的请求体均为JSON数据(JSON对象)。
-- 当请求处理成功时,响应状态码为`200`,响应体的属性如下:
+- Both the response body and the request body for POST requests are JSON data (JSON objects).
+- When the request is processed successfully, the response status code is `200`, and the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。固定为`0`。|
-    |`errorMsg`|`string`|错误说明。固定为`"Success"`。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Fixed as `0`.|
+    |`errorMsg`|`string`|Error message. Fixed as `"Success"`.|
 
-    响应体还可能有`result`属性,类型为`object`,其中存储操作结果信息。
+    The response body may also have a `result` attribute of type `object`, which stores the operation result information.
 
-- 当请求处理未成功时,响应体的属性如下:
+- When the request is not processed successfully, the response body attributes are as follows:
 
-    |名称|类型|含义|
-    |-|-|-|
-    |`errorCode`|`integer`|错误码。与响应状态码相同。|
-    |`errorMsg`|`string`|错误说明。|
+    | Name | Type | Description |
+    |------|------|-------------|
+    |`errorCode`|`integer`|Error code. Same as the response status code.|
+    |`errorMsg`|`string`|Error message.|
 
-服务提供的操作如下:
+Operations provided by the service are as follows:
 
 - **`infer`**
 
-    进行时序预测。
+    Performs time-series forecasting.
 
     `POST /time-series-forecasting`
 
-    - 请求体的属性如下:
+    - The request body attributes are as follows:
 
-        |名称|类型|含义|是否必填|
-        |-|-|-|-|
-        |`csv`|`string`|服务可访问的CSV文件的URL或CSV文件内容的Base64编码结果。CSV文件需要使用UTF-8编码。|是|
+        | Name | Type | Description | Required |
+        |------|------|-------------|----------|
+        |`csv`|`string`|The URL of a CSV file accessible by the service or the Base64 encoded result of the CSV file content. The CSV file must be encoded in UTF-8.|Yes|
 
-    - 请求处理成功时,响应体的`result`具有如下属性:
+    - When the request is processed successfully, the `result` of the response body has the following attributes:
 
-        |名称|类型|含义|
-        |-|-|-|
-        |`csv`|`string`|CSV格式的时序预测结果。使用UTF-8+Base64编码。|
+        | Name | Type | Description |
+        |------|------|-------------|
+        |`csv`|`string`|The time-series forecasting result in CSV format. Encoded in UTF-8+Base64.|
 
-        `result`示例如下:
+        An example of `result` is as follows:
 
         ```json
         {
@@ -221,42 +221,39 @@ Below are the API references and multi-language service invocation examples:
 </details>
 
 <details>
-<summary>Multilingual Service Invocation Examples</summary>  
+<summary>Multilingual Service Invocation Examples</summary>
+
+<details>
+<summary>Python</summary>
 
-<details>  
-<summary>Python</summary>  
-  
 ```python
 import base64
 import requests
 
-API_URL = "http://localhost:8080/time-series-forecasting" # 服务URL
+API_URL = "http://localhost:8080/time-series-forecasting"
 csv_path = "./test.csv"
 output_csv_path = "./out.csv"
 
-# 对本地csv进行Base64编码
 with open(csv_path, "rb") as file:
     csv_bytes = file.read()
     csv_data = base64.b64encode(csv_bytes).decode("ascii")
 
 payload = {"csv": csv_data}
 
-# 调用API
 response = requests.post(API_URL, json=payload)
 
-# 处理接口返回数据
 assert response.status_code == 200
 result = response.json()["result"]
 with open(output_csv_path, "wb") as f:
     f.write(base64.b64decode(result["csv"]))
 print(f"Output time-series data saved at  {output_csv_path}")
 ```
-  
+
 </details>
 
-<details>  
-<summary>C++</summary>  
-  
+<details>
+<summary>C++</summary>
+
 ```cpp
 #include <iostream>
 #include "cpp-httplib/httplib.h" // https://github.com/Huiyicc/cpp-httplib
@@ -272,7 +269,6 @@ int main() {
         {"Content-Type", "application/json"}
     };
 
-    // 进行Base64编码
     std::ifstream file(csvPath, std::ios::binary | std::ios::ate);
     std::streamsize size = file.tellg();
     file.seekg(0, std::ios::beg);
@@ -289,14 +285,11 @@ int main() {
     jsonObj["csv"] = encodedCsv;
     std::string body = jsonObj.dump();
 
-    // 调用API
     auto response = client.Post("/time-series-forecasting", headers, body, "application/json");
-    // 处理接口返回数据
     if (response && response->status == 200) {
         nlohmann::json jsonResponse = nlohmann::json::parse(response->body);
         auto result = jsonResponse["result"];
 
-        // 保存数据
         encodedCsv = result["csv"];
         decodedString = base64::from_base64(encodedCsv);
         std::vector<unsigned char> decodedCsv(decodedString.begin(), decodedString.end());
@@ -317,12 +310,12 @@ int main() {
     return 0;
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Java</summary>  
-  
+<details>
+<summary>Java</summary>
+
 ```java
 import okhttp3.*;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -340,7 +333,6 @@ public class Main {
         String csvPath = "./test.csv";
         String outputCsvPath = "./out.csv";
 
-        // 对本地csv进行Base64编码
         File file = new File(csvPath);
         byte[] fileContent = java.nio.file.Files.readAllBytes(file.toPath());
         String csvData = Base64.getEncoder().encodeToString(fileContent);
@@ -349,7 +341,6 @@ public class Main {
         ObjectNode params = objectMapper.createObjectNode();
         params.put("csv", csvData);
 
-        // 创建 OkHttpClient 实例
         OkHttpClient client = new OkHttpClient();
         MediaType JSON = MediaType.Companion.get("application/json; charset=utf-8");
         RequestBody body = RequestBody.Companion.create(params.toString(), JSON);
@@ -358,14 +349,12 @@ public class Main {
                 .post(body)
                 .build();
 
-        // 调用API并处理接口返回数据
         try (Response response = client.newCall(request).execute()) {
             if (response.isSuccessful()) {
                 String responseBody = response.body().string();
                 JsonNode resultNode = objectMapper.readTree(responseBody);
                 JsonNode result = resultNode.get("result");
 
-                // 保存返回的数据
                 String base64Csv = result.get("csv").asText();
                 byte[] csvBytes = Base64.getDecoder().decode(base64Csv);
                 try (FileOutputStream fos = new FileOutputStream(outputCsvPath)) {
@@ -379,97 +368,93 @@ public class Main {
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Go</summary>  
-  
+<details>
+<summary>Go</summary>
+
 ```go
 package main
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"io/ioutil"
-	"net/http"
+    "bytes"
+    "encoding/base64"
+    "encoding/json"
+    "fmt"
+    "io/ioutil"
+    "net/http"
 )
 
 func main() {
-	API_URL := "http://localhost:8080/time-series-forecasting"
-	csvPath := "./test.csv";
-	outputCsvPath := "./out.csv";
-
-	// 读取csv文件并进行Base64编码
-	csvBytes, err := ioutil.ReadFile(csvPath)
-	if err != nil {
-		fmt.Println("Error reading csv file:", err)
-		return
-	}
-	csvData := base64.StdEncoding.EncodeToString(csvBytes)
-
-	payload := map[string]string{"csv": csvData} // Base64编码的文件内容
-	payloadBytes, err := json.Marshal(payload)
-	if err != nil {
-		fmt.Println("Error marshaling payload:", err)
-		return
-	}
-
-	// 调用API
-	client := &http.Client{}
-	req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
-	if err != nil {
-		fmt.Println("Error creating request:", err)
-		return
-	}
-
-	res, err := client.Do(req)
-	if err != nil {
-		fmt.Println("Error sending request:", err)
-		return
-	}
-	defer res.Body.Close()
-
-	// 处理返回数据
-	body, err := ioutil.ReadAll(res.Body)
-	if err != nil {
-		fmt.Println("Error reading response body:", err)
-		return
-	}
-	type Response struct {
-		Result struct {
-			Csv string `json:"csv"`
-		} `json:"result"`
-	}
-	var respData Response
-	err = json.Unmarshal([]byte(string(body)), &respData)
-	if err != nil {
-		fmt.Println("Error unmarshaling response body:", err)
-		return
-	}
-
-	// 将Base64编码的csv数据解码并保存为文件
-	outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)
-	if err != nil {
-		fmt.Println("Error decoding base64 csv data:", err)
-		return
-	}
-	err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)
-	if err != nil {
-		fmt.Println("Error writing csv to file:", err)
-		return
-	}
-	fmt.Printf("Output time-series data saved at %s.csv", outputCsvPath)
+    API_URL := "http://localhost:8080/time-series-forecasting"
+    csvPath := "./test.csv";
+    outputCsvPath := "./out.csv";
+
+    csvBytes, err := ioutil.ReadFile(csvPath)
+    if err != nil {
+        fmt.Println("Error reading csv file:", err)
+        return
+    }
+    csvData := base64.StdEncoding.EncodeToString(csvBytes)
+
+    payload := map[string]string{"csv": csvData}
+    payloadBytes, err := json.Marshal(payload)
+    if err != nil {
+        fmt.Println("Error marshaling payload:", err)
+        return
+    }
+
+    client := &http.Client{}
+    req, err := http.NewRequest("POST", API_URL, bytes.NewBuffer(payloadBytes))
+    if err != nil {
+        fmt.Println("Error creating request:", err)
+        return
+    }
+
+    res, err := client.Do(req)
+    if err != nil {
+        fmt.Println("Error sending request:", err)
+        return
+    }
+    defer res.Body.Close()
+
+    body, err := ioutil.ReadAll(res.Body)
+    if err != nil {
+        fmt.Println("Error reading response body:", err)
+        return
+    }
+    type Response struct {
+        Result struct {
+            Csv string `json:"csv"`
+        } `json:"result"`
+    }
+    var respData Response
+    err = json.Unmarshal([]byte(string(body)), &respData)
+    if err != nil {
+        fmt.Println("Error unmarshaling response body:", err)
+        return
+    }
+
+    outputCsvData, err := base64.StdEncoding.DecodeString(respData.Result.Csv)
+    if err != nil {
+        fmt.Println("Error decoding base64 csv data:", err)
+        return
+    }
+    err = ioutil.WriteFile(outputCsvPath, outputCsvData, 0644)
+    if err != nil {
+        fmt.Println("Error writing csv to file:", err)
+        return
+    }
+    fmt.Printf("Output time-series data saved at %s.csv", outputCsvPath)
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>C#</summary>  
-  
+<details>
+<summary>C#</summary>
+
 ```csharp
 using System;
 using System.IO;
@@ -489,22 +474,18 @@ class Program
     {
         var httpClient = new HttpClient();
 
-        // 对本地csv文件进行Base64编码
         byte[] csvBytes = File.ReadAllBytes(csvPath);
         string csvData = Convert.ToBase64String(csvBytes);
 
-        var payload = new JObject{ { "csv", csvData } }; // Base64编码的文件内容
+        var payload = new JObject{ { "csv", csvData } };
         var content = new StringContent(payload.ToString(), Encoding.UTF8, "application/json");
 
-        // 调用API
         HttpResponseMessage response = await httpClient.PostAsync(API_URL, content);
         response.EnsureSuccessStatusCode();
 
-        // 处理接口返回数据
         string responseBody = await response.Content.ReadAsStringAsync();
         JObject jsonResponse = JObject.Parse(responseBody);
 
-        // 保存csv文件
         string base64Csv = jsonResponse["result"]["csv"].ToString();
         byte[] outputCsvBytes = Convert.FromBase64String(base64Csv);
         File.WriteAllBytes(outputCsvPath, outputCsvBytes);
@@ -512,12 +493,12 @@ class Program
     }
 }
 ```
-  
+
 </details>
 
-<details>  
-<summary>Node.js</summary>  
-  
+<details>
+<summary>Node.js</summary>
+
 ```js
 const axios = require('axios');
 const fs = require('fs');
@@ -531,11 +512,10 @@ let config = {
    maxBodyLength: Infinity,
    url: API_URL,
    data: JSON.stringify({
-    'csv': encodeFileToBase64(csvPath)  // Base64编码的文件内容
+    'csv': encodeFileToBase64(csvPath)
   })
 };
 
-// 读取csv文件并转换为Base64
 function encodeFileToBase64(filePath) {
   const bitmap = fs.readFileSync(filePath);
   return Buffer.from(bitmap).toString('base64');
@@ -545,7 +525,6 @@ axios.request(config)
 .then((response) => {
     const result = response.data["result"];
 
-    // 保存csv文件
     const csvBuffer = Buffer.from(result["csv"], 'base64');
     fs.writeFile(outputCsvPath, csvBuffer, (err) => {
       if (err) throw err;
@@ -556,24 +535,22 @@ axios.request(config)
   console.log(error);
 });
 ```
-  
+
 </details>
 
-<details>  
-<summary>PHP</summary>  
-  
+<details>
+<summary>PHP</summary>
+
 ```php
 <?php
 
-$API_URL = "http://localhost:8080/time-series-forecasting"; // 服务URL
+$API_URL = "http://localhost:8080/time-series-forecasting";
 $csv_path = "./test.csv";
 $output_csv_path = "./out.csv";
 
-// 对本地csv文件进行Base64编码
 $csv_data = base64_encode(file_get_contents($csv_path));
-$payload = array("csv" => $csv_data); // Base64编码的文件内容
+$payload = array("csv" => $csv_data);
 
-// 调用API
 $ch = curl_init($API_URL);
 curl_setopt($ch, CURLOPT_POST, true);
 curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
@@ -581,7 +558,6 @@ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 $response = curl_exec($ch);
 curl_close($ch);
 
-// 处理接口返回数据
 $result = json_decode($response, true)["result"];
 
 file_put_contents($output_csv_path, base64_decode($result["csv"]));