package com.xindao.ocr.swingui.controller;
|
|
import com.xindao.ocr.swingui.dto.OcrDTO;
|
import com.xindao.ocr.swingui.service.OcrService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@RestController
|
@RequestMapping("/ocr")
|
public class OcrController {
|
|
@Autowired
|
private OcrService ocrService;
|
|
@PostMapping("/recognize")
|
public String recognizeText(@RequestBody OcrDTO ocrDTO) {
|
// 这里应该调用OCR模型进行文本识别
|
// 由于具体实现依赖于OCR库,这里仅返回一个空列表作为示例
|
return ocrService.ocr(ocrDTO.getImagePath());
|
}
|
|
}
|