Skip to content

Commit

Permalink
경로 재설정
Browse files Browse the repository at this point in the history
  • Loading branch information
SalkCoding committed Dec 18, 2024
1 parent 4c5123d commit ecf9e0b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

@Service
public class LotteryAINumberService {

private final URL scriptURL
= getClass().getClassLoader().getResource("ai/lottery_probability_predictor.py");

public JsonNode getAINumberResults() {
JsonNode aiNumberResults = null;

try {
ProcessBuilder processBuilder = new ProcessBuilder("python3", "lottery_probability_predictor.py");
ProcessBuilder processBuilder = new ProcessBuilder("python3", scriptURL.getPath());
Process process = processBuilder.start();

BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

@Service
@RequiredArgsConstructor
public class LotteryAIPriceService {

private final String scriptPath = getClass().getResource("/AI/lottery_prediction.py").getPath();
private final URL scriptURL
= getClass().getClassLoader().getResource("ai/lottery_prediction.py");

public String executePythonPredictionScript() {
try {
// Python 스크립트 실행
ProcessBuilder processBuilder = new ProcessBuilder("python3", scriptPath);
ProcessBuilder processBuilder = new ProcessBuilder("python3", scriptURL.getPath());
processBuilder.redirectErrorStream(true);
Process process = processBuilder.start();

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit ecf9e0b

Please sign in to comment.