Allow pull data from python all the way through to the UI
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Python.Runtime;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace PythonInterop {
|
||||
|
||||
@@ -29,10 +30,13 @@ namespace PythonInterop {
|
||||
}
|
||||
}
|
||||
|
||||
public void PredictAI() {
|
||||
public double[] PredictAI() {
|
||||
using (Py.GIL()) {
|
||||
dynamic main = Py.Import("ai-predictor");
|
||||
dynamic result = main.Predict();
|
||||
string result = main.Predict();
|
||||
double[]? predictions = JsonSerializer.Deserialize<double[]>(result);
|
||||
double[] nullCasted = predictions != null ? predictions : [];
|
||||
return nullCasted;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user