增加在线标注
This commit is contained in:
parent
7b6429a58c
commit
75dab1689b
|
|
@ -89,7 +89,7 @@ public class OnlineAnnotationServiceOkHttp {
|
|||
* task <------> 人工智能数据中心的具体的标注文件
|
||||
* task 增删改查
|
||||
*/
|
||||
public TaskParam createTask(TaskParam taskParam) throws IOException {
|
||||
public TaskParam createTask(TaskInputParam taskParam) throws IOException {
|
||||
String url = onlineAnnotateConfig.getUrl()+ "/tasks/";
|
||||
String json = objectMapper.writeValueAsString(taskParam);
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public class OnlineAnnotationServiceOkHttp {
|
|||
return response != null && !response.isEmpty();
|
||||
}
|
||||
|
||||
public TaskParam updateTask(TaskParam taskParam) throws IOException {
|
||||
public TaskParam updateTask(TaskInputParam taskParam) throws IOException {
|
||||
String url = onlineAnnotateConfig.getUrl()+ "/tasks/"+ taskParam.getId() + "/";
|
||||
|
||||
String json = objectMapper.writeValueAsString(taskParam);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package com.bonus.ai.client;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Data
|
||||
public class TaskInputParam {
|
||||
|
||||
private Data data;
|
||||
|
||||
private Long project;
|
||||
|
||||
private Long id;
|
||||
// Getters and Setters for all fields
|
||||
|
||||
@lombok.Data
|
||||
public static class Data {
|
||||
private String image;
|
||||
private String text;
|
||||
}
|
||||
|
||||
public static class UpdatedBy {
|
||||
@JsonProperty("user_id")
|
||||
private int userId;
|
||||
|
||||
// Getters and Setters
|
||||
}
|
||||
|
||||
public static TaskInputParam fromJson(String json) throws JsonProcessingException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// 注册 Java 时间模块
|
||||
mapper.registerModule(new JavaTimeModule());
|
||||
return mapper.readValue(json, TaskInputParam.class);
|
||||
}
|
||||
|
||||
public String toJson() throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.writeValueAsString(this);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws JsonProcessingException {
|
||||
String json = "{\n" +
|
||||
" \"data\": {\n" +
|
||||
" \"image\": \"https://example.com/image.jpg\",\n" +
|
||||
" \"text\": \"Hello, world!\"\n" +
|
||||
" },\n" +
|
||||
" \"project\": 4\n" +
|
||||
"}";
|
||||
|
||||
|
||||
System.out.println(json);
|
||||
|
||||
TaskInputParam record = TaskInputParam.fromJson(json);
|
||||
System.out.println("Image URL: " + record.getData().getImage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -109,8 +109,8 @@ public class AnnotationTaskServiceImpl implements AnnotationTaskService {
|
|||
entity.setTaskId(annotationTaskid);
|
||||
Long finalProjectId = projectId;
|
||||
executorService.execute(()->{
|
||||
TaskParam taskParam = new TaskParam();
|
||||
TaskParam.Data data = new TaskParam.Data();
|
||||
TaskInputParam taskParam = new TaskInputParam();
|
||||
TaskInputParam.Data data = new TaskInputParam.Data();
|
||||
String imageUrl = minioConfig.getEndpoint() + "/" + minioConfig.getBucketName() + "/"+ entity.getFileUrl();
|
||||
data.setImage(imageUrl);
|
||||
data.setText("Hello, world!");
|
||||
|
|
|
|||
Loading…
Reference in New Issue