AnlaAnla 2 tygodni temu
rodzic
commit
6394c1c2ff
2 zmienionych plików z 8 dodań i 2 usunięć
  1. 1 0
      Test/minio测试.py
  2. 7 2
      app/api/rating_report.py

+ 1 - 0
Test/minio测试.py

@@ -42,6 +42,7 @@ try:
         print(f"存储桶 {MINIO_BUCKET} 已存在")
         print(f"存储桶 {MINIO_BUCKET} 已存在")
 
 
     object_name = "img_test.jpg"
     object_name = "img_test.jpg"
+    img_path = "./img.jpg"
     cloud_path = os.path.join(MINIO_BASE_PREFIX, object_name).replace("\\", "/")
     cloud_path = os.path.join(MINIO_BASE_PREFIX, object_name).replace("\\", "/")
 
 
     minio_client.fput_object(MINIO_BUCKET, cloud_path, img_path, content_type="image/jpeg")
     minio_client.fput_object(MINIO_BUCKET, cloud_path, img_path, content_type="image/jpeg")

+ 7 - 2
app/api/rating_report.py

@@ -268,8 +268,13 @@ def generate_rating_report(
         # 构造 Type 字符串: defect_type + label (大写)
         # 构造 Type 字符串: defect_type + label (大写)
         # 例如: defect_type="edge", label="wear" -> "EDGE WEAR"
         # 例如: defect_type="edge", label="wear" -> "EDGE WEAR"
         d_type_raw = defect.get("defect_type", "")
         d_type_raw = defect.get("defect_type", "")
-        d_label_raw = defect.get("label", "")
-        type_str = f"{d_type_raw.upper()} {d_label_raw.upper()}".strip()
+        # d_label_raw = defect.get("label", "")
+
+        type_str = f"{d_type_raw.upper()}".strip()
+        type_str_map = {"CORNER": "CORNER",
+                        "EDGE": "SIDE",
+                        "FACE": "SURFACE"}
+        type_str = type_str_map.get(type_str)
 
 
         final_defect_list.append({
         final_defect_list.append({
             "id": d_id,
             "id": d_id,