OcrController.java
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//package com.xly.ocr.web;
//
//import com.xly.ocr.service.OcrService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@RestController
//@RequestMapping("/api/ocr")
//public class OcrController {
//
// @Autowired
// private OcrService ocrService;
//
// @PostMapping("/extract")
// public ResponseEntity<Map<String, Object>> extractText(
// @RequestParam("file") MultipartFile file) {
//
// Map<String, Object> response = new HashMap<>();
// long startTime = System.currentTimeMillis();
//
// String result = ocrService.extractTextFromMultipartFile(file);
//
// response.put("text", result);
// response.put("time", System.currentTimeMillis() - startTime);
// response.put("success", !result.startsWith("错误") && !result.startsWith("失败"));
//
// return ResponseEntity.ok(response);
// }
//
// @PostMapping("/batch")
// public ResponseEntity<List<String>> batchExtract(
// @RequestParam("files") List<MultipartFile> files) {
// List<String> results = ocrService.batchExtractText(files);
// return ResponseEntity.ok(results);
// }
//}