when i start up the suika/nsfwjs docker, i can't invoke the api. #919
zhuyanxuan
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
here is the java code:`// 使用 Spring 的 RestTemplate
MultipartFile file = ...; // 上传的图片
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("image", new ByteArrayResource(file.getBytes()) {
@OverRide
public String getFilename() {
return file.getOriginalFilename();
}
});
ResponseEntity response = restTemplate.postForEntity(
"http://localhost:3000/predict",
new HttpEntity<>(body, headers),
String.class
);`
Beta Was this translation helpful? Give feedback.
All reactions