-
Notifications
You must be signed in to change notification settings - Fork 0
/
training.php
33 lines (33 loc) · 1.19 KB
/
training.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
session_start();
$time_start = microtime(true);
// $pyscript = 'C:\\xampp\\htdocs\\SVM\\training_SVR.py';
// $python = 'C:\\Users\\USER\\Anaconda2\\python.exe';
// $cmd = "$python $pyscript";
ini_set('max_execution_time', 180);
$str_komoditas = strtolower($_POST['komoditas']);
if($_POST['komoditas'] == "BERAS"){
$str_komoditas = "beras";
} elseif($_POST['komoditas'] == "JAGUNG"){
$str_komoditas = "jagung";
} elseif($_POST['komoditas'] == "KEDELAI"){
$str_komoditas = "kedelai";
} elseif($_POST['komoditas'] == "BAWANG MERAH"){
$str_komoditas = "bawang_merah";
} elseif($_POST['komoditas'] == "CABE BESAR"){
$str_komoditas = "cabe_besar";
} else{
$str_komoditas = "cabe_rawit";
}
$str_input = "python -c \"import training_SVR; print training_SVR.main('".$str_komoditas."')\"";
echo "sukses";
// shell_exec("python -c \"import training_SVR; print training_SVR.main('jagung')\"");
shell_exec($str_input);
$time_end = microtime(true);
$time = $time_end - $time_start;
$_SESSION['training'] = "0";
$_SESSION['komoditas'] = $_POST['komoditas'];
?>
<script type="text/javascript">
window.location.href = 'data.php';
</script>