package com.iailab.module.model.command;
|
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.iailab.module.mcs.dto.StModelDTO;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.stereotype.Component;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2023年05月17日 11:50:00
|
*/
|
@Slf4j
|
@Component
|
public class PyCommand {
|
|
public String[] getCommand(StModelDTO stModel, List<Object> params, Map<String, Object> settings) {
|
String[] command = new String[2 + params.size() + 1];
|
command[0] = "python";
|
command[1] = stModel.getModelPath();
|
for (int i = 0; i < params.size(); i++) {
|
command[2 + i] = JSONArray.toJSONString(params.get(i));
|
}
|
command[command.length - 1] = JSONObject.toJSONString(settings).replace("\"", "'");
|
return command;
|
}
|
}
|