private void runPython() { PipeClient client; python = new PythonExecutor(); if (!python.CanRun) { if (System.IO.File.Exists("Python35\\python.exe")) { python = new PythonExecutor("Python35\\python.exe"); } else if (MessageBox.Show("Unable to find python.\nDo you want to download an example interpreter from cheonghyun.com?", "IpcPythonCS", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { PythonDownloader down = new PythonDownloader(); down.DownloadAndUnzip(); python = new PythonExecutor(down.PythonInterpreter.FullName); } else { MessageBox.Show("This application cannot run without Python.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } python.RunScript("main.py"); client = new PipeClient(); client.Connect("calculator"); calculator = new PyCalculator(client); }
private void Init() { isFirstLoad = true; Predictions = null; python = !string.IsNullOrEmpty(pythonPath) ? new PythonExecutor(pythonPath) : new PythonExecutor(); python.AddStandartOutputErrorFilters("Using TensorFlow backend."); python.AddStandartOutputErrorFilters("CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected"); client = new PipeClient(); predict = new Predict(client); python.OnPythonError += Python_OnPythonError; TinfoBox.Start(initText, title); python.RunScript("main.py"); client.Connect("openstsm"); }
public void RunSelectiveSearch() { Predict predict; PythonExecutor python = new PythonExecutor(@"C:\Users\kutiatore\AppData\Local\Programs\Python\Python35\python.exe"); python.AddStandartOutputErrorFilters("Using TensorFlow backend."); python.AddStandartOutputErrorFilters("CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected"); PipeClient client = new PipeClient(); predict = new Predict(client); try { python.RunScript("main.py"); client.Connect("openstsm"); predict = new Predict(client); bool run = predict.LoadModel(@"E:\\Storage\\Python\\OpenSTSM\\ML\\models\\model.model"); run = predict.ImageDimessionCorrections("E:\\Libraries\\Desktop\\Visa Docs\\test_selective_1.png"); run = predict.RunSelectiveSearch(80, 1.0f); string results = predict.RunPrediction(5, 3, 5, 1, 8, 2, true); client.Close(); python.Close(); } catch (System.Exception e) { System.Diagnostics.Debug.WriteLine("---------------------"); System.Diagnostics.Debug.WriteLine(e.StackTrace); System.Diagnostics.Debug.WriteLine("---------------------"); if (client.isConnected()) { client.Close(); } python.Close(); } }