From 2d2cb6345ed3067ce8fae73f9c1e171d733e9a87 Mon Sep 17 00:00:00 2001
From: hpy <2924418812@qq.com>
Date: Thu, 12 Jun 2025 16:14:59 +0800
Subject: [PATCH] =?UTF-8?q?=E7=8B=AC=E7=AB=8BOCR=E4=B8=8ETranslate?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/ImageCraft.iml | 2 +-
.idea/misc.xml | 2 +-
.../demo/controller/OcrController.java | 151 +-----------------
.../demo/controller/TranslateController.java | 127 +++++++++++++++
4 files changed, 134 insertions(+), 148 deletions(-)
create mode 100644 java/demo/src/main/java/com/example/demo/controller/TranslateController.java
diff --git a/.idea/ImageCraft.iml b/.idea/ImageCraft.iml
index b400132..f843a40 100644
--- a/.idea/ImageCraft.iml
+++ b/.idea/ImageCraft.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index caad013..6bcbed4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -8,5 +8,5 @@
-
+
\ No newline at end of file
diff --git a/java/demo/src/main/java/com/example/demo/controller/OcrController.java b/java/demo/src/main/java/com/example/demo/controller/OcrController.java
index 16bd0ea..b1cfa47 100644
--- a/java/demo/src/main/java/com/example/demo/controller/OcrController.java
+++ b/java/demo/src/main/java/com/example/demo/controller/OcrController.java
@@ -2,7 +2,6 @@
import com.example.demo.pojo.OcrBean;
import com.example.demo.service.OcrService;
-import com.example.demo.service.TranslateService;
import com.example.demo.util.PathUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,38 +28,29 @@
public class OcrController {
private final Path oriImgDir;
private final Path resTxtDir;
- private final Path transTxtDir;
private final OcrService ocrService;
- private final TranslateService translateService;
@Autowired
public OcrController(
@Value("${file.upload-dir.ocr.oriImg}") String oriImgDir,
@Value("${file.upload-dir.ocr.resTxt}") String resTxtDir,
- @Value("${file.upload-dir.ocr.transTxt}") String transTxtDir,
- OcrService ocrService,
- TranslateService translateService) {
+ OcrService ocrService) {
this.oriImgDir = Paths.get(oriImgDir).toAbsolutePath().normalize();
this.resTxtDir = Paths.get(resTxtDir).toAbsolutePath().normalize();
- this.transTxtDir = Paths.get(transTxtDir).toAbsolutePath().normalize();
this.ocrService = ocrService;
- this.translateService = translateService;
- log.info("OCR控制器初始化完成,图片目录: {}, 识别结果目录: {}, 翻译结果目录: {}",
- this.oriImgDir, this.resTxtDir, this.transTxtDir);
+ log.info("OCR控制器初始化完成,图片目录: {}, 识别结果目录: {}", this.oriImgDir, this.resTxtDir);
}
@PostMapping("/upload")
public ResponseEntity