import java.io.BufferedReader;
import java.io.InputStreamReader;
public class PythonModelCaller {
public static void main(String[] args) {
try {
// 创建Python进程并执行模型
Process process = Runtime.getRuntime().exec("C:\Code\scikit-learn\examples\linear_model/plot_bayesian_ridge_curvefit.py");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
// 读取Python脚本的输出
String line;
while ((line = reader.readLine()) != null) {
System.out.println("Python output: " + line);
}
// 等待进程执行完毕
process.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}