//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> extractText( // @RequestParam("file") MultipartFile file) { // // Map 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> batchExtract( // @RequestParam("files") List files) { // List results = ocrService.batchExtractText(files); // return ResponseEntity.ok(results); // } //}