提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.model.command; |
H |
2 |
|
|
3 |
import com.alibaba.fastjson.JSONArray; |
|
4 |
import com.alibaba.fastjson.JSONObject; |
|
5 |
import com.iailab.module.mcs.dto.StModelDTO; |
|
6 |
import lombok.extern.slf4j.Slf4j; |
|
7 |
import org.springframework.stereotype.Component; |
|
8 |
|
|
9 |
import java.util.List; |
|
10 |
import java.util.Map; |
|
11 |
|
|
12 |
/** |
|
13 |
* @author PanZhibao |
|
14 |
* @Description |
|
15 |
* @createTime 2023年05月17日 11:50:00 |
|
16 |
*/ |
|
17 |
@Slf4j |
|
18 |
@Component |
|
19 |
public class PyCommand { |
|
20 |
|
|
21 |
public String[] getCommand(StModelDTO stModel, List<Object> params, Map<String, Object> settings) { |
|
22 |
String[] command = new String[2 + params.size() + 1]; |
|
23 |
command[0] = "python"; |
|
24 |
command[1] = stModel.getModelPath(); |
|
25 |
for (int i = 0; i < params.size(); i++) { |
|
26 |
command[2 + i] = JSONArray.toJSONString(params.get(i)); |
|
27 |
} |
|
28 |
command[command.length - 1] = JSONObject.toJSONString(settings).replace("\"", "'"); |
|
29 |
return command; |
|
30 |
} |
|
31 |
} |