对接前端和py接口SegAnything
This commit is contained in:
@@ -23,6 +23,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
@@ -119,4 +122,14 @@ public class PythonController {
|
||||
return Response.success(superResolutionService.prepareForSR(superResolutionDTO));
|
||||
}
|
||||
|
||||
@CrossOrigin
|
||||
@Operation(summary = "Seg Anything 转发接口")
|
||||
@PostMapping("/segAnything")
|
||||
public Response<JSONObject> segAnything(@RequestBody Map<String, Object> payload) {
|
||||
// 将前端传来的 Map 转为 fastjson JSONObject 并转发给 python 服务
|
||||
JSONObject requestJson = (JSONObject) JSON.toJSON(payload);
|
||||
JSONObject result = pythonService.segAnything(requestJson);
|
||||
return Response.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user